-
Notifications
You must be signed in to change notification settings - Fork 51
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
Add testing functionality for WaitExecution #393
base: master
Are you sure you want to change the base?
Conversation
Retrying based on an operation error is always incorrect, although mostly harmless. Once an operation has an error, it is marked as Done and should never be unmarked, so retries will simply fetch the same operation (with the same error) again.
The existing ExecuteAndWait function will rarely actually call WaitExecution when used against a live server. This change adds the ability to terminate the Execute call early and switch to WaitExecution immediately so that it's possible for service implementors to test WaitExecution.
@@ -255,6 +256,9 @@ func (c *Client) ExecuteAndWaitProgress(ctx context.Context, req *repb.ExecuteRe | |||
progress(metadata) | |||
} | |||
} | |||
if returnEarly { | |||
return status.Error(codes.Internal, "fake error to for wait call") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "(...) error to for wait (...)", shouldn't it be, "(...) error to trigger the wait (...)"
// ForceEarlyWaitCalls specifies whether ExecuteAndWait should call WaitExecution immedately | ||
// after receiving an Operation from Execute. It is primarily useful for testing | ||
// WaitExecution. | ||
ForceEarlyWaitCalls bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not inheretly opposed to this... But I think the most appropriate place for this behavior would be on the fake server: https://github.com/bazelbuild/remote-apis-sdks/blob/af1232ee0d79920ab8390fb855f95dca18a69cf0/go/pkg/fakes/exec.go. Wdyt?
The existing ExecuteAndWait function will rarely actually call
WaitExecution when used against a live server. This change adds the
ability to terminate the Execute call early and switch to WaitExecution
immediately so that it's possible for service implementors to test
WaitExecution.