dra e2e: using logging for background activity

ginkgo.By should be used for steps in the test flow. Creating and deleting CDI
files happens in parallel to that. If reported via ginkgo.By, progress reports
look weird because they contain e.g. step "waiting for...." (from the main
test, which is still on-going) and end with "creating CDI file" (which is
already completed).
This commit is contained in:
Patrick Ohly 2023-06-28 15:18:14 +02:00
parent b3d94ae74f
commit 4a5a242a68

View File

@ -214,11 +214,11 @@ func (d *Driver) SetUp(nodes *Nodes, resources app.Resources) {
plugin, err := app.StartPlugin(logger, "/cdi", d.Name, nodename,
app.FileOperations{
Create: func(name string, content []byte) error {
ginkgo.By(fmt.Sprintf("creating CDI file %s on node %s:\n%s", name, nodename, string(content)))
klog.Background().Info("creating CDI file", "node", nodename, "filename", name, "content", string(content))
return d.createFile(&pod, name, content)
},
Remove: func(name string) error {
ginkgo.By(fmt.Sprintf("deleting CDI file %s on node %s", name, nodename))
klog.Background().Info("deleting CDI file", "node", nodename, "filename", name)
return d.removeFile(&pod, name)
},
},