pkg/machine/e2e: switch to GinkgoWriter

Directly writing to stdout/err is not safe when run in parallel.
Ginkgo v2 fixed this buffering the output and syncing the output so it
is not mangled between tests.

This is the same as for the podman integration tests.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-05-02 12:05:56 +02:00
parent c4b9f4b34e
commit 5af4339237
2 changed files with 4 additions and 10 deletions

View File

@ -50,8 +50,6 @@ type machineTestBuilder struct {
// number of seconds
func (ms *machineSession) waitWithTimeout(timeout time.Duration) {
Eventually(ms, timeout).Should(Exit())
os.Stdout.Sync()
os.Stderr.Sync()
}
func (ms *machineSession) Bytes() []byte {
@ -154,7 +152,7 @@ func runWrapper(podmanBinary string, cmdArgs []string, timeout time.Duration, wa
if len(os.Getenv("DEBUG")) > 0 {
cmdArgs = append([]string{"--log-level=debug"}, cmdArgs...)
}
fmt.Println(podmanBinary + " " + strings.Join(cmdArgs, " "))
GinkgoWriter.Println(podmanBinary + " " + strings.Join(cmdArgs, " "))
c := exec.Command(podmanBinary, cmdArgs...)
session, err := Start(c, GinkgoWriter, GinkgoWriter)
if err != nil {
@ -164,7 +162,6 @@ func runWrapper(podmanBinary string, cmdArgs []string, timeout time.Duration, wa
ms := machineSession{session}
if wait {
ms.waitWithTimeout(timeout)
fmt.Println("output:", ms.outputToString())
}
return &ms, nil
}