From 48ae43751883af976f9d7c3b447ef375eedad608 Mon Sep 17 00:00:00 2001 From: Vishwas Siravara Date: Sat, 7 Oct 2023 00:39:45 +0000 Subject: [PATCH] chore: adjust timeouts for tests (#92) Issue #, if available: *Description of changes:* Update timeouts for tests. *Testing done:* Yes on windows server - [X] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: Vishwas Siravara Co-authored-by: Vishwas Siravara --- tests/cp.go | 2 +- tests/run.go | 4 ++-- tests/stop.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cp.go b/tests/cp.go index c53376d..cf1cb14 100644 --- a/tests/cp.go +++ b/tests/cp.go @@ -105,7 +105,7 @@ func Cp(o *option.Option) { ginkgo.When("the container is not running", func() { ginkgo.It("should be able to copy file from host to container", func() { - command.Run(o, "run", "--name", testContainerName, defaultImage, "sleep", "1") + command.Run(o, "run", "--name", testContainerName, defaultImage, "sleep", "5") command.Run(o, "stop", testContainerName) path := ffs.CreateTempFile(filename, content) ginkgo.DeferCleanup(os.RemoveAll, filepath.Dir(path)) diff --git a/tests/run.go b/tests/run.go index 76a20f6..d9b693f 100644 --- a/tests/run.go +++ b/tests/run.go @@ -234,7 +234,7 @@ func Run(o *RunOption) { startTime := time.Now() command.Run(o.BaseOpt, "stop", testContainerName) // assert the container to be stopped within 1.5 seconds - gomega.Expect(time.Since(startTime)).To(gomega.BeNumerically("~", 0*time.Millisecond, 1500*time.Millisecond)) + gomega.Expect(time.Since(startTime)).To(gomega.BeNumerically("~", 0*time.Millisecond, 2500*time.Millisecond)) command.RunWithoutSuccessfulExit(o.BaseOpt, "exec", testContainerName, "echo", "foo") }) @@ -244,7 +244,7 @@ func Run(o *RunOption) { containerShouldBeRunning(o.BaseOpt, testContainerName) startTime := time.Now() command.Run(o.BaseOpt, "stop", testContainerName) - gomega.Expect(time.Since(startTime)).To(gomega.BeNumerically("~", 0*time.Millisecond, 500*time.Millisecond)) + gomega.Expect(time.Since(startTime)).To(gomega.BeNumerically("~", 0*time.Millisecond, 2000*time.Millisecond)) status := command.StdoutStr(o.BaseOpt, "inspect", "--format", "{{.State.Status}}", testContainerName) gomega.Expect(status).Should(gomega.Equal("exited")) command.RunWithoutSuccessfulExit(o.BaseOpt, "exec", testContainerName, "echo", "foo") diff --git a/tests/stop.go b/tests/stop.go index ace239f..7000ded 100644 --- a/tests/stop.go +++ b/tests/stop.go @@ -40,7 +40,7 @@ func Stop(o *option.Option) { gomega.Expect(command.StdoutStr(o, "exec", testContainerName, "echo", "foo")).To(gomega.Equal("foo")) startTime := time.Now() command.Run(o, "stop", "-t", "1", testContainerName) - gomega.Expect(time.Since(startTime)).To(gomega.BeNumerically("~", 1*time.Second, 750*time.Millisecond)) + gomega.Expect(time.Since(startTime)).To(gomega.BeNumerically("~", 1*time.Second, 1500*time.Millisecond)) command.RunWithoutSuccessfulExit(o, "exec", testContainerName, "echo", "foo") }) }