Skip to content

Commit

Permalink
chore: adjust timeouts for tests (#92)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Co-authored-by: Vishwas Siravara <[email protected]>
  • Loading branch information
vsiravar and Vishwas Siravara authored Oct 7, 2023
1 parent b66ffd8 commit 48ae437
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions tests/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})

Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
}
Expand Down

0 comments on commit 48ae437

Please sign in to comment.