-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add custom wait for retry logic #141
Conversation
I skimmed through gexec's source and couldn't find the assertion you mentioned. Can you post a link in case something like this happens again? |
its goexec internals. |
I see, it either exits before timeout, or it fails due to the |
yes |
I think this might be a little easier to read, lmk what you think exitCodeChan := make(chan int)
exitCode := -1
for i := 0; i < retryPull && exitCode != 0; i++ {
go func(retry int) {
s := command.New(o, "pull", ref).WithoutWait().Run()
for {
select {
case <-s.Exited:
fmt.Printf("\nExited (attempt %d)\n", retry)
exitCodeChan <- s.ExitCode()
return
case <-time.After(30 * time.Second):
fmt.Printf("\nTimed out (attempt %d)\n", retry)
exitCodeChan <- -1
s.Interrupt().Kill()
return
}
}
}(i)
exitCode = <-exitCodeChan
}
if exitCode != 0 {
ginkgo.Fail(fmt.Sprintf("Failed to pull image: %s", ref))
} |
simplified the code. |
Signed-off-by: Shubharanshu Mahapatra <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [0.7.21](v0.7.20...v0.7.21) (2024-03-28) ### Bug Fixes * add a delay for system event monitoring to start before pull completes as the run commands are async ([#144](#144)) ([5de585f](5de585f)) * add custom wait for retry logic ([#141](#141)) ([3b69319](3b69319)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Issue #, if available:
Description of changes:
Add a custom wait logic as the wait for goexec has an assertion, that marks the test fail in case of timeout.
eventually is usually also used with an assertion.
Without the wait logic the retry wont work due to assertion
Testing done:
License Acceptance
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.