mirror of https://github.com/containers/podman.git
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:
parent
c4b9f4b34e
commit
5af4339237
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ var _ = BeforeSuite(func() {
|
|||
if err := machine.DownloadVMImage(getMe, suiteImageName, fqImageName+".xz"); err != nil {
|
||||
Fail(fmt.Sprintf("unable to download machine image: %q", err))
|
||||
}
|
||||
fmt.Println("Download took: ", time.Since(now).String())
|
||||
GinkgoWriter.Println("Download took: ", time.Since(now).String())
|
||||
if err := machine.Decompress(fqImageName+".xz", fqImageName); err != nil {
|
||||
Fail(fmt.Sprintf("unable to decompress image file: %q", err))
|
||||
}
|
||||
|
|
@ -71,10 +71,7 @@ var _ = BeforeSuite(func() {
|
|||
}
|
||||
})
|
||||
|
||||
var _ = SynchronizedAfterSuite(func() {},
|
||||
func() {
|
||||
fmt.Println("After")
|
||||
})
|
||||
var _ = SynchronizedAfterSuite(func() {}, func() {})
|
||||
|
||||
func setup() (string, *machineTestBuilder) {
|
||||
// Set TMPDIR if this needs a new directory
|
||||
|
|
@ -127,7 +124,7 @@ func teardown(origHomeDir string, testDir string, mb *machineTestBuilder) {
|
|||
r := new(rmMachine)
|
||||
for _, name := range mb.names {
|
||||
if _, err := mb.setName(name).setCmd(r.withForce()).run(); err != nil {
|
||||
fmt.Printf("error occurred rm'ing machine: %q\n", err)
|
||||
GinkgoWriter.Printf("error occurred rm'ing machine: %q\n", err)
|
||||
}
|
||||
}
|
||||
if err := machine.GuardedRemoveAll(testDir); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue