Skip to content

Commit

Permalink
fix: increase acceptable time deviation for stop tests with -t (#81)
Browse files Browse the repository at this point in the history
Issue #, if available:

*Description of changes:*

Increase acceptable time deviation from 500ms -> 750ms.

This test checks to see that the `-t/--time` flag waits a certain amount
of time (in the test's case, 1s) before sending the stop signal and
killing the container. We're currently seeing fairly frequent failures
of this test in `finch-core`, with stop times very slightly outside of
the acceptable range:

-
[1.529945577s](https://github.com/runfinch/finch-core/actions/runs/6228992440/job/16933345175?pr=159#step:7:13397)
-
[1.528963170s](https://github.com/runfinch/finch-core/actions/runs/6228992440/job/16933345175?pr=159#step:7:13397)
-
[1.502652516s](https://github.com/runfinch/finch-core/actions/runs/6228992440/job/16933345175?pr=159#step:7:13314)
- etc...

This exact timing isn't super critical, and these test failures are kind
of painful for merging PRs, so increasing the allowable deviation makes
sense here.

*Testing done:*



- [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: Sam Berning <[email protected]>
  • Loading branch information
sam-berning authored Sep 20, 2023
1 parent 5496e94 commit c292f6d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tests/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"

"github.com/runfinch/common-tests/command"
"github.com/runfinch/common-tests/option"
)
Expand Down Expand Up @@ -41,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, 500*time.Millisecond))
gomega.Expect(time.Since(startTime)).To(gomega.BeNumerically("~", 1*time.Second, 750*time.Millisecond))
command.RunWithoutSuccessfulExit(o, "exec", testContainerName, "echo", "foo")
})
}
Expand Down

0 comments on commit c292f6d

Please sign in to comment.