in cmd/resgraph/viz/main.go [113:188]
func showStep(w http.ResponseWriter, cl cloud.Cloud, idx int, step *testlib.Step) {
outln, outf := wrapWriter(w)
outln("<hr />")
outf("<h2>Step %d</h2>", idx)
if step.SetUp != nil {
step.SetUp(cl)
}
result, err := plan.Do(context.Background(), cl, step.Graph)
klog.Infof("plan.Do() = _, %v", err)
outln("<pre>")
outf("plan.Do() = _, %v", err)
outln("</pre>")
if err != nil {
return
}
outln("<h3>Got graph</h3>")
outln("")
svg, err := dotSVG(graphviz.Do(result.Got))
if err == nil {
outln(svg)
} else {
klog.Infof("dotSVG(Got) = _, %v", err)
outf("dotSVG() = %v", err)
}
outln("")
outln("<h3>Want graph</h3>")
outln("")
svg, err = dotSVG(graphviz.Do(result.Want))
if err == nil {
outln(svg)
} else {
klog.Infof("dotSVG(Want) = _, %v", err)
outf("dotSVG() = %v", err)
}
outln("")
var viz exec.GraphvizTracer
ex, err := exec.NewSerialExecutor(cl, result.Actions, exec.DryRunOption(false), exec.TracerOption(&viz))
if err != nil {
outf("NewSerialExecutor() = %v, want nil", err)
return
}
execResult, err := ex.Run(context.Background())
outln("<h3>Plan</h3>")
outln("")
svg, err = dotSVG(viz.String())
if err == nil {
outln(svg)
} else {
klog.Infof("dotSVG(viz) = _, %v", err)
outf("<pre>dotSVG() = %v</pre>", err)
}
outln("")
outln("<h3>Pending Actions</h3>\n")
klog.Infof("Pending actions = %d", len(execResult.Pending))
if len(execResult.Pending) == 0 {
outln("No pending actions remain; all actions were executable.")
} else {
outln("<ol>")
for _, item := range execResult.Pending {
outf("<li>%+v</li>", item.Metadata())
}
outln("</ol>")
}
}