Skip to content

Commit

Permalink
fix: allow propagation time for async conditions (#111)
Browse files Browse the repository at this point in the history
Issue #, if available: Seen several tests fail (especially on Windows)
because of these types of checks. See:
https://github.com/runfinch/finch/actions/runs/7493150724/job/20398226027
and
https://github.com/runfinch/finch/actions/runs/7493200344/job/20398390738

*Description of changes:*
- Adds a timeout and polling to these checks. This should have no impact
when the condition is achieved quickly, but allow it to take up to 15
seconds at the worst case

*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: Justin Alvarez <[email protected]>
  • Loading branch information
pendo324 authored Jan 12, 2024
1 parent 0921b98 commit 8aeb41a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 7 additions & 1 deletion tests/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package tests

import (
"time"

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

Expand All @@ -26,7 +28,11 @@ func Events(o *option.Option) {
defer session.Kill()
gomega.Expect(session.Out.Contents()).Should(gomega.BeEmpty())
command.Run(o, "pull", defaultImage)
gomega.Expect(session.Out.Contents()).Should(gomega.ContainSubstring(defaultImage))
// allow propagation time
gomega.Eventually(session.Out.Contents()).
WithTimeout(15 * time.Second).
WithPolling(1 * time.Second).
Should(gomega.ContainSubstring(defaultImage))
})
})
}
7 changes: 5 additions & 2 deletions tests/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ func Logs(o *option.Option) {
defer session.Kill()
gomega.Expect(session.Out.Contents()).Should(gomega.BeEmpty())
command.Run(o, "exec", testContainerName, "sh", "-c", fmt.Sprintf("echo %s >> /proc/1/fd/1", newLog))
output := strings.TrimSpace(string(session.Out.Contents()))
gomega.Expect(output).Should(gomega.Equal(newLog))
// allow propagation time
gomega.Eventually(strings.TrimSpace(string(session.Out.Contents()))).
WithTimeout(15 * time.Second).
WithPolling(1 * time.Second).
Should(gomega.Equal(newLog))
})
}
})
Expand Down

0 comments on commit 8aeb41a

Please sign in to comment.