diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index 53ff69292c..f9d352b4a8 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -105,7 +105,7 @@ var _ = SynchronizedBeforeSuite(func() []byte { // make cache dir ImageCacheDir = filepath.Join(os.TempDir(), "imagecachedir") if err := os.MkdirAll(ImageCacheDir, 0700); err != nil { - fmt.Printf("%q\n", err) + GinkgoWriter.Printf("%q\n", err) os.Exit(1) } @@ -122,7 +122,7 @@ var _ = SynchronizedBeforeSuite(func() []byte { } if err := os.MkdirAll(filepath.Join(ImageCacheDir, podman.ImageCacheFS+"-images"), 0777); err != nil { - fmt.Printf("%q\n", err) + GinkgoWriter.Printf("%q\n", err) os.Exit(1) } podman.Root = ImageCacheDir @@ -134,19 +134,19 @@ var _ = SynchronizedBeforeSuite(func() []byte { if host.Distribution == "rhel" && strings.HasPrefix(host.Version, "7") { f, err := os.OpenFile("/proc/sys/user/max_user_namespaces", os.O_WRONLY, 0644) if err != nil { - fmt.Println("Unable to enable userspace on RHEL 7") + GinkgoWriter.Println("Unable to enable userspace on RHEL 7") os.Exit(1) } _, err = f.WriteString("15000") if err != nil { - fmt.Println("Unable to enable userspace on RHEL 7") + GinkgoWriter.Println("Unable to enable userspace on RHEL 7") os.Exit(1) } f.Close() } path, err := os.MkdirTemp("", "libpodlock") if err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) os.Exit(1) } @@ -170,9 +170,9 @@ func (p *PodmanTestIntegration) Setup() { var _ = SynchronizedAfterSuite(func() {}, func() { sort.Sort(testResultsSortedLength{testResults}) - fmt.Println("integration timing results") + GinkgoWriter.Println("integration timing results") for _, result := range testResults { - fmt.Printf("%s\t\t%f\n", result.name, result.length) + GinkgoWriter.Printf("%s\t\t%f\n", result.name, result.length) } // previous runroot @@ -184,7 +184,7 @@ var _ = SynchronizedAfterSuite(func() {}, defer os.RemoveAll(tempdir) if err := os.RemoveAll(podmanTest.Root); err != nil { - fmt.Printf("%q\n", err) + GinkgoWriter.Printf("%q\n", err) } // If running remote, we need to stop the associated podman system service @@ -376,7 +376,7 @@ func (p *PodmanTestIntegration) createArtifact(image string) { } destName := imageTarPath(image) if _, err := os.Stat(destName); os.IsNotExist(err) { - fmt.Printf("Caching %s at %s...\n", image, destName) + GinkgoWriter.Printf("Caching %s at %s...\n", image, destName) pull := p.PodmanNoCache([]string{"pull", image}) pull.Wait(440) Expect(pull).Should(Exit(0)) @@ -384,9 +384,9 @@ func (p *PodmanTestIntegration) createArtifact(image string) { save := p.PodmanNoCache([]string{"save", "-o", destName, image}) save.Wait(90) Expect(save).Should(Exit(0)) - fmt.Printf("\n") + GinkgoWriter.Printf("\n") } else { - fmt.Printf("[image already cached: %s]\n", destName) + GinkgoWriter.Printf("[image already cached: %s]\n", destName) } } @@ -419,7 +419,7 @@ func GetPortLock(port string) *lockfile.LockFile { lockFile := filepath.Join(LockTmpDir, port) lock, err := lockfile.GetLockFile(lockFile) if err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) os.Exit(1) } lock.Lock() @@ -534,7 +534,7 @@ func (p *PodmanTestIntegration) BuildImageWithLabel(dockerfile, imageName string // PodmanPID execs podman and returns its PID func (p *PodmanTestIntegration) PodmanPID(args []string) (*PodmanSessionIntegration, int) { podmanOptions := p.MakeOptions(args, false, false) - fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " ")) + GinkgoWriter.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " ")) command := exec.Command(p.PodmanBinary, podmanOptions...) session, err := Start(command, GinkgoWriter, GinkgoWriter) @@ -546,7 +546,7 @@ func (p *PodmanTestIntegration) PodmanPID(args []string) (*PodmanSessionIntegrat } func (p *PodmanTestIntegration) Quadlet(args []string, sourceDir string) *PodmanSessionIntegration { - fmt.Printf("Running: %s %s with QUADLET_UNIT_DIRS=%s\n", p.QuadletBinary, strings.Join(args, " "), sourceDir) + GinkgoWriter.Printf("Running: %s %s with QUADLET_UNIT_DIRS=%s\n", p.QuadletBinary, strings.Join(args, " "), sourceDir) command := exec.Command(p.QuadletBinary, args...) command.Env = []string{fmt.Sprintf("QUADLET_UNIT_DIRS=%s", sourceDir)} @@ -607,7 +607,7 @@ func (p *PodmanTestIntegration) CleanupSecrets() { // Nuke tempdir if err := os.RemoveAll(p.TempDir); err != nil { - fmt.Printf("%q\n", err) + GinkgoWriter.Printf("%q\n", err) } } @@ -667,7 +667,7 @@ func (p *PodmanTestIntegration) RunHealthCheck(cid string) error { ps.WaitWithDefaultTimeout() if ps.ExitCode() == 0 { if !strings.Contains(ps.OutputToString(), cid) { - fmt.Printf("Container %s is not running, restarting", cid) + GinkgoWriter.Printf("Container %s is not running, restarting", cid) restart := p.Podman([]string{"restart", cid}) restart.WaitWithDefaultTimeout() if restart.ExitCode() != 0 { @@ -675,7 +675,7 @@ func (p *PodmanTestIntegration) RunHealthCheck(cid string) error { } } } - fmt.Printf("Waiting for %s to pass healthcheck\n", cid) + GinkgoWriter.Printf("Waiting for %s to pass healthcheck\n", cid) time.Sleep(1 * time.Second) } return fmt.Errorf("unable to detect %s as running", cid) @@ -865,7 +865,7 @@ func (p *PodmanTestIntegration) RestartRemoteService() { func (p *PodmanTestIntegration) RestoreArtifactToCache(image string) error { tarball := imageTarPath(image) if _, err := os.Stat(tarball); err == nil { - fmt.Printf("Restoring %s...\n", image) + GinkgoWriter.Printf("Restoring %s...\n", image) p.Root = p.ImageCacheDir restore := p.PodmanNoEvents([]string{"load", "-q", "-i", tarball}) restore.WaitWithDefaultTimeout() @@ -879,7 +879,7 @@ func populateCache(podman *PodmanTestIntegration) { Expect(err).ToNot(HaveOccurred()) } // logformatter uses this to recognize the first test - fmt.Printf("-----------------------------\n") + GinkgoWriter.Printf("-----------------------------\n") } func (p *PodmanTestIntegration) removeCache(path string) { @@ -894,7 +894,7 @@ func (p *PodmanTestIntegration) removeCache(path string) { } } else { if err := os.RemoveAll(path); err != nil { - fmt.Printf("%q\n", err) + GinkgoWriter.Printf("%q\n", err) } } } @@ -951,17 +951,17 @@ func (p *PodmanTestIntegration) makeOptions(args []string, noEvents, noCache boo func writeConf(conf []byte, confPath string) { if _, err := os.Stat(filepath.Dir(confPath)); os.IsNotExist(err) { if err := os.MkdirAll(filepath.Dir(confPath), 0o777); err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) } } if err := os.WriteFile(confPath, conf, 0o777); err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) } } func removeConf(confPath string) { if err := os.Remove(confPath); err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) } } @@ -1138,7 +1138,7 @@ func ncz(port int) bool { timeout := 500 * time.Millisecond for i := 0; i < 5; i++ { ncCmd := []string{"-z", "localhost", fmt.Sprintf("%d", port)} - fmt.Printf("Running: nc %s\n", strings.Join(ncCmd, " ")) + GinkgoWriter.Printf("Running: nc %s\n", strings.Join(ncCmd, " ")) check := SystemExec("nc", ncCmd) if check.ExitCode() == 0 { return true diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go index 8d16cc1de6..2cdeba20a1 100644 --- a/test/e2e/events_test.go +++ b/test/e2e/events_test.go @@ -96,7 +96,7 @@ var _ = Describe("Podman events", func() { result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0)) events := result.OutputToStringArray() - fmt.Println(events) + GinkgoWriter.Println(events) Expect(len(events)).To(BeNumerically(">=", 2), "Number of events") Expect(events).To(ContainElement(ContainSubstring(" pod create "))) Expect(events).To(ContainElement(ContainSubstring(" pod stop "))) diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go index a8cc629ae4..92b8fb6e9d 100644 --- a/test/e2e/libpod_suite_remote_test.go +++ b/test/e2e/libpod_suite_remote_test.go @@ -88,7 +88,7 @@ func (p *PodmanTestIntegration) StartRemoteService() { command := exec.Command(p.PodmanBinary, podmanOptions...) command.Stdout = os.Stdout command.Stderr = os.Stderr - fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " ")) + GinkgoWriter.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " ")) err := command.Start() Expect(err).ToNot(HaveOccurred()) command.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} @@ -145,11 +145,11 @@ func getRemoteOptions(p *PodmanTestIntegration, args []string) []string { func (p *PodmanTestIntegration) RestoreArtifact(image string) error { tarball := imageTarPath(image) if _, err := os.Stat(tarball); err == nil { - fmt.Printf("Restoring %s...\n", image) + GinkgoWriter.Printf("Restoring %s...\n", image) args := []string{"load", "-q", "-i", tarball} podmanOptions := getRemoteOptions(p, args) command := exec.Command(p.PodmanBinary, podmanOptions...) - fmt.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " ")) + GinkgoWriter.Printf("Running: %s %s\n", p.PodmanBinary, strings.Join(podmanOptions, " ")) if err := command.Start(); err != nil { return err } diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index 32898c7e3a..8a44d5c7da 100644 --- a/test/e2e/libpod_suite_test.go +++ b/test/e2e/libpod_suite_test.go @@ -4,10 +4,10 @@ package integration import ( - "fmt" "os" "path/filepath" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) @@ -62,7 +62,7 @@ func PodmanTestCreate(tempDir string) *PodmanTestIntegration { func (p *PodmanTestIntegration) RestoreArtifact(image string) error { tarball := imageTarPath(image) if _, err := os.Stat(tarball); err == nil { - fmt.Printf("Restoring %s...\n", image) + GinkgoWriter.Printf("Restoring %s...\n", image) restore := p.PodmanNoEvents([]string{"load", "-q", "-i", tarball}) restore.Wait(90) } diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go index a42a86cc58..979498ffff 100644 --- a/test/e2e/load_test.go +++ b/test/e2e/load_test.go @@ -40,7 +40,7 @@ var _ = Describe("Podman load", func() { images := podmanTest.Podman([]string{"images"}) images.WaitWithDefaultTimeout() - fmt.Println(images.OutputToStringArray()) + GinkgoWriter.Println(images.OutputToStringArray()) save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE}) save.WaitWithDefaultTimeout() diff --git a/test/e2e/login_logout_test.go b/test/e2e/login_logout_test.go index 4dd2c2c31f..9e0f261517 100644 --- a/test/e2e/login_logout_test.go +++ b/test/e2e/login_logout_test.go @@ -106,7 +106,7 @@ var _ = Describe("Podman login and logout", func() { var authInfo map[string]interface{} err = json.Unmarshal(authBytes, &authInfo) Expect(err).ToNot(HaveOccurred()) - fmt.Println(authInfo) + GinkgoWriter.Println(authInfo) const authsKey = "auths" Expect(authInfo).To(HaveKey(authsKey)) diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index d8d5471ee9..64026a5562 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -2781,7 +2781,7 @@ var _ = Describe("Podman play kube", func() { // expect play kube is expected to set a seccomp label if it's applied as an annotation jsonFile, err := podmanTest.CreateSeccompJSON(seccompPwdEPERM) if err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) Skip("Failed to prepare seccomp.json for test.") } @@ -2808,7 +2808,7 @@ var _ = Describe("Podman play kube", func() { // expect play kube is expected to set a seccomp label if it's applied as an annotation jsonFile, err := podmanTest.CreateSeccompJSON(seccompPwdEPERM) if err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) Skip("Failed to prepare seccomp.json for test.") } defer os.Remove(jsonFile) diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go index e00e5b579a..049d0646da 100644 --- a/test/e2e/pod_kill_test.go +++ b/test/e2e/pod_kill_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/podman/v4/test/utils" @@ -148,7 +147,7 @@ var _ = Describe("Podman pod kill", func() { result := podmanTest.Podman([]string{"pod", "kill", "-a"}) result.WaitWithDefaultTimeout() - fmt.Println(result.OutputToString(), result.ErrorToString()) + GinkgoWriter.Println(result.OutputToString(), result.ErrorToString()) Expect(result).Should(Exit(0)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) diff --git a/test/e2e/pod_pod_namespaces_test.go b/test/e2e/pod_pod_namespaces_test.go index 9bc7d037db..f466dcedd6 100644 --- a/test/e2e/pod_pod_namespaces_test.go +++ b/test/e2e/pod_pod_namespaces_test.go @@ -1,7 +1,6 @@ package integration import ( - "fmt" "os" . "github.com/containers/podman/v4/test/utils" @@ -54,9 +53,9 @@ var _ = Describe("Podman pod create", func() { Expect(outputArray).To(HaveLen(2)) NAMESPACE1 := outputArray[0] - fmt.Println("NAMESPACE1:", NAMESPACE1) + GinkgoWriter.Println("NAMESPACE1:", NAMESPACE1) NAMESPACE2 := outputArray[1] - fmt.Println("NAMESPACE2:", NAMESPACE2) + GinkgoWriter.Println("NAMESPACE2:", NAMESPACE2) Expect(NAMESPACE1).To(Equal(NAMESPACE2)) }) @@ -100,9 +99,9 @@ var _ = Describe("Podman pod create", func() { Expect(outputArray).To(HaveLen(2)) NAMESPACE1 := outputArray[0] - fmt.Println("NAMESPACE1:", NAMESPACE1) + GinkgoWriter.Println("NAMESPACE1:", NAMESPACE1) NAMESPACE2 := outputArray[1] - fmt.Println("NAMESPACE2:", NAMESPACE2) + GinkgoWriter.Println("NAMESPACE2:", NAMESPACE2) Expect(NAMESPACE1).To(Not(Equal(NAMESPACE2))) }) diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go index 684818597a..d2e2a564f5 100644 --- a/test/e2e/pod_rm_test.go +++ b/test/e2e/pod_rm_test.go @@ -116,28 +116,28 @@ var _ = Describe("Podman pod rm", func() { }) It("podman pod rm -a doesn't remove a running container", func() { - fmt.Printf("To start, there are %d pods\n", podmanTest.NumberOfPods()) + GinkgoWriter.Printf("To start, there are %d pods\n", podmanTest.NumberOfPods()) _, ec, podid1 := podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) _, ec, _ = podmanTest.CreatePod(nil) Expect(ec).To(Equal(0)) - fmt.Printf("Started %d pods\n", podmanTest.NumberOfPods()) + GinkgoWriter.Printf("Started %d pods\n", podmanTest.NumberOfPods()) session := podmanTest.RunTopContainerInPod("", podid1) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) podmanTest.WaitForContainer() Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) - fmt.Printf("Started container running in one pod") + GinkgoWriter.Printf("Started container running in one pod") numPods := podmanTest.NumberOfPods() Expect(numPods).To(Equal(2)) ps := podmanTest.Podman([]string{"pod", "ps"}) ps.WaitWithDefaultTimeout() - fmt.Printf("Current %d pod(s):\n%s\n", numPods, ps.OutputToString()) + GinkgoWriter.Printf("Current %d pod(s):\n%s\n", numPods, ps.OutputToString()) - fmt.Printf("Removing all empty pods\n") + GinkgoWriter.Printf("Removing all empty pods\n") result := podmanTest.Podman([]string{"pod", "rm", "-a"}) result.WaitWithDefaultTimeout() Expect(result).To(ExitWithError()) @@ -147,7 +147,7 @@ var _ = Describe("Podman pod rm", func() { numPods = podmanTest.NumberOfPods() ps = podmanTest.Podman([]string{"pod", "ps"}) ps.WaitWithDefaultTimeout() - fmt.Printf("Final %d pod(s):\n%s\n", numPods, ps.OutputToString()) + GinkgoWriter.Printf("Final %d pod(s):\n%s\n", numPods, ps.OutputToString()) Expect(numPods).To(Equal(1)) // Confirm top container still running inside remaining pod Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go index e6b21fed0a..263721d670 100644 --- a/test/e2e/pod_top_test.go +++ b/test/e2e/pod_top_test.go @@ -135,7 +135,7 @@ var _ = Describe("Podman top", func() { Expect(session).Should(Exit(0)) for i := 0; i < 10; i++ { - fmt.Println("Waiting for containers to be running .... ") + GinkgoWriter.Println("Waiting for containers to be running .... ") if podmanTest.NumberOfContainersRunning() == 2 { break } diff --git a/test/e2e/quadlet_test.go b/test/e2e/quadlet_test.go index 3e65746085..f04cc9d41d 100644 --- a/test/e2e/quadlet_test.go +++ b/test/e2e/quadlet_test.go @@ -518,7 +518,7 @@ var _ = Describe("quadlet system generator", func() { // Print any stderr output errs := session.ErrorToString() if errs != "" { - fmt.Println("error:", session.ErrorToString()) + GinkgoWriter.Println("error:", session.ErrorToString()) } testcase.check(generatedDir, session) diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go index 47092f6ca4..5ea21092ac 100644 --- a/test/e2e/run_signal_test.go +++ b/test/e2e/run_signal_test.go @@ -69,7 +69,7 @@ var _ = Describe("Podman run with --sig-proxy", func() { buf := make([]byte, 1024) n, err := uds.Read(buf) if err != nil && err != io.EOF { - fmt.Println(err) + GinkgoWriter.Println(err) return } data := string(buf[0:n]) @@ -95,7 +95,7 @@ var _ = Describe("Podman run with --sig-proxy", func() { buf := make([]byte, 1024) n, err := uds.Read(buf) if err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) return } data := string(buf[0:n]) diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go index 1121db8441..5552f46008 100644 --- a/test/e2e/run_staticip_test.go +++ b/test/e2e/run_staticip_test.go @@ -126,9 +126,9 @@ var _ = Describe("Podman run with --ip flag", func() { } if err != nil { - fmt.Printf("nginx not ready yet; error=%v; %d retries left...\n", err, retries) + GinkgoWriter.Printf("nginx not ready yet; error=%v; %d retries left...\n", err, retries) } else { - fmt.Printf("nginx not ready yet; response=%v; %d retries left...\n", response.StatusCode, retries) + GinkgoWriter.Printf("nginx not ready yet; response=%v; %d retries left...\n", response.StatusCode, retries) } time.Sleep(1 * time.Second) } diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 7ceed87a96..3d94ea6832 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -341,7 +341,7 @@ var _ = Describe("Podman run", func() { in := []byte(`{"defaultAction":"SCMP_ACT_ALLOW","syscalls":[{"name":"getcwd","action":"SCMP_ACT_ERRNO"}]}`) jsonFile, err := podmanTest.CreateSeccompJSON(in) if err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) Skip("Failed to prepare seccomp.json for test.") } return jsonFile @@ -1486,7 +1486,7 @@ USER mail`, BB) curCgroupsBytes, err := os.ReadFile("/proc/self/cgroup") Expect(err).ShouldNot(HaveOccurred()) curCgroups := trim(string(curCgroupsBytes)) - fmt.Printf("Output:\n%s\n", curCgroups) + GinkgoWriter.Printf("Output:\n%s\n", curCgroups) Expect(curCgroups).ToNot(Equal("")) container := podmanTest.Podman([]string{"run", "--cgroupns=host", "--cgroups=disabled", ALPINE, "cat", "/proc/self/cgroup"}) @@ -1494,7 +1494,7 @@ USER mail`, BB) Expect(container).Should(Exit(0)) ctrCgroups := trim(container.OutputToString()) - fmt.Printf("Output\n:%s\n", ctrCgroups) + GinkgoWriter.Printf("Output\n:%s\n", ctrCgroups) Expect(ctrCgroups).To(Equal(curCgroups)) }) @@ -1509,7 +1509,7 @@ USER mail`, BB) curCgroupsBytes, err := os.ReadFile("/proc/self/cgroup") Expect(err).ToNot(HaveOccurred()) var curCgroups string = string(curCgroupsBytes) - fmt.Printf("Output:\n%s\n", curCgroups) + GinkgoWriter.Printf("Output:\n%s\n", curCgroups) Expect(curCgroups).To(Not(Equal(""))) ctrName := "testctr" @@ -1526,7 +1526,7 @@ USER mail`, BB) ctrCgroupsBytes, err := os.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid)) Expect(err).ToNot(HaveOccurred()) var ctrCgroups string = string(ctrCgroupsBytes) - fmt.Printf("Output\n:%s\n", ctrCgroups) + GinkgoWriter.Printf("Output\n:%s\n", ctrCgroups) Expect(curCgroups).To(Not(Equal(ctrCgroups))) }) diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go index ca0e3e3fa9..427b546161 100644 --- a/test/e2e/run_volume_test.go +++ b/test/e2e/run_volume_test.go @@ -390,7 +390,7 @@ var _ = Describe("Podman run with volumes", func() { os.Stdout.Sync() os.Stderr.Sync() mountOut1 := strings.Join(strings.Fields(string(mountCmd1.Out.Contents())), " ") - fmt.Printf("Output: %s", mountOut1) + GinkgoWriter.Printf("Output: %s", mountOut1) Expect(mountOut1).To(Not(ContainSubstring(volName))) ctrName := "testctr" @@ -406,7 +406,7 @@ var _ = Describe("Podman run with volumes", func() { os.Stdout.Sync() os.Stderr.Sync() mountOut2 := strings.Join(strings.Fields(string(mountCmd2.Out.Contents())), " ") - fmt.Printf("Output: %s", mountOut2) + GinkgoWriter.Printf("Output: %s", mountOut2) Expect(mountOut2).To(ContainSubstring(volName)) // Stop the container to unmount @@ -427,7 +427,7 @@ var _ = Describe("Podman run with volumes", func() { os.Stdout.Sync() os.Stderr.Sync() mountOut3 := strings.Join(strings.Fields(string(mountCmd3.Out.Contents())), " ") - fmt.Printf("Output: %s", mountOut3) + GinkgoWriter.Printf("Output: %s", mountOut3) Expect(mountOut3).To(Not(ContainSubstring(volName))) }) diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go index 808ed8bac2..edc1a96349 100644 --- a/test/e2e/toolbox_test.go +++ b/test/e2e/toolbox_test.go @@ -90,7 +90,7 @@ var _ = Describe("Toolbox-specific testing", func() { err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit) Expect(err).ToNot(HaveOccurred()) - fmt.Printf("Expected value: %d", rlimit.Max) + GinkgoWriter.Printf("Expected value: %d", rlimit.Max) session = podmanTest.Podman([]string{"create", "--name", "test", "--ulimit", "host", ALPINE, "sleep", "1000"}) diff --git a/test/utils/utils.go b/test/utils/utils.go index e32fc88e03..24c435ac20 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -117,9 +117,9 @@ func (p *PodmanTest) PodmanAsUserBase(args []string, uid, gid uint32, cwd string runCmd = append(runCmd, podmanBinary) if env == nil { - fmt.Printf("Running: %s %s\n", strings.Join(runCmd, " "), strings.Join(podmanOptions, " ")) + GinkgoWriter.Printf("Running: %s %s\n", strings.Join(runCmd, " "), strings.Join(podmanOptions, " ")) } else { - fmt.Printf("Running: (env: %v) %s %s\n", env, strings.Join(runCmd, " "), strings.Join(podmanOptions, " ")) + GinkgoWriter.Printf("Running: (env: %v) %s %s\n", env, strings.Join(runCmd, " "), strings.Join(podmanOptions, " ")) } if uid != 0 || gid != 0 { pythonCmd := fmt.Sprintf("import os; import sys; uid = %d; gid = %d; cwd = '%s'; os.setgid(gid); os.setuid(uid); os.chdir(cwd) if len(cwd)>0 else True; os.execv(sys.argv[1], sys.argv[1:])", gid, uid, cwd) @@ -159,7 +159,7 @@ func (p *PodmanTest) WaitForContainer() bool { } time.Sleep(1 * time.Second) } - fmt.Printf("WaitForContainer(): timed out\n") + GinkgoWriter.Printf("WaitForContainer(): timed out\n") return false } @@ -226,7 +226,7 @@ func (p *PodmanTest) WaitContainerReady(id string, expStr string, timeout int, s for { if time.Since(startTime) >= time.Duration(timeout)*time.Second { - fmt.Printf("Container %s is not ready in %ds", id, timeout) + GinkgoWriter.Printf("Container %s is not ready in %ds", id, timeout) return false } @@ -354,7 +354,7 @@ func (s *PodmanSession) LineInOutputContainsTag(repo, tag string) bool { func (s *PodmanSession) IsJSONOutputValid() bool { var i interface{} if err := json.Unmarshal(s.Out.Contents(), &i); err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) return false } return true @@ -374,7 +374,6 @@ func (s *PodmanSession) WaitWithTimeout(timeout int) { }) os.Stdout.Sync() os.Stderr.Sync() - fmt.Println("output:", s.OutputToString()) } // CreateTempDirInTempDir create a temp dir with prefix podman_test @@ -385,7 +384,7 @@ func CreateTempDirInTempDir() (string, error) { // SystemExec is used to exec a system command to check its exit code or output func SystemExec(command string, args []string) *PodmanSession { c := exec.Command(command, args...) - fmt.Println("Execing " + c.String() + "\n") + GinkgoWriter.Println("Execing " + c.String() + "\n") session, err := Start(c, GinkgoWriter, GinkgoWriter) if err != nil { Fail(fmt.Sprintf("unable to run command: %s %s", command, strings.Join(args, " "))) @@ -397,7 +396,7 @@ func SystemExec(command string, args []string) *PodmanSession { // StartSystemExec is used to start exec a system command func StartSystemExec(command string, args []string) *PodmanSession { c := exec.Command(command, args...) - fmt.Println("Execing " + c.String() + "\n") + GinkgoWriter.Println("Execing " + c.String() + "\n") session, err := Start(c, GinkgoWriter, GinkgoWriter) if err != nil { Fail(fmt.Sprintf("unable to run command: %s %s", command, strings.Join(args, " "))) diff --git a/test/utils/utils_suite_test.go b/test/utils/utils_suite_test.go index b31f07c536..cace354d45 100644 --- a/test/utils/utils_suite_test.go +++ b/test/utils/utils_suite_test.go @@ -1,7 +1,6 @@ package utils_test import ( - "fmt" "io" "os/exec" "strings" @@ -41,7 +40,7 @@ func StartFakeCmdSession(args []string) *PodmanSession { command := exec.Command(GoechoPath, args...) session, err := gexec.Start(command, outWriter, errWriter) if err != nil { - fmt.Println(err) + GinkgoWriter.Println(err) } return &PodmanSession{session} }