-
Notifications
You must be signed in to change notification settings - Fork 15
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 tests for SDK extras and fix execute
#933
Conversation
sdk/src/extras/disk.rs
Outdated
let (fut, handle) = self.execute_with_control()?; | ||
|
||
// Leak the handle so we don't cancel the request by dropping it. | ||
mem::forget(handle); |
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.
this seems a bit inelegant. Did we consider other options such as a run_without_cancel
function, ignoring cancelation from cancel_rx
in run_with_cancel
or returning a new Future
here that holds onto the handle so that it isn't dropped.
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.
That's fair, I've added a run
method that doesn't take a cancel channel.
Also: worth adding a test here? |
execute
Yes, great point! I've added a high level test for this. |
@@ -0,0 +1,135 @@ | |||
use httpmock::MockServer; |
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.
Add the license and copyright headers?
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.
Good catch, thanks
Currently `execute` will drop the import handle immediately, inadvertently canceling the request. Leak the handle, which will never be used, so that we allow the request to run to completion. Closes #930
We've been relying on the CLI disk import tests to cover the `extras` disk importer in the SDK. However, the CLI does not use the `execute` method, and we missed that this was failing immediately due to the cancellation sender being dropped before the request could awaited. Add tests for `extras` to validate that both options work. Also, add a method to DiskImport that does not accept cancellation and use that in `execute`.
1805b5e
to
44881dd
Compare
Rebased to resolve merge conflict. |
We've been relying on the CLI disk import tests to cover the
extras
disk importer in the SDK. However, the CLI does not use theexecute
method, and we missed that this was failing immediately due to the cancellation sender being dropped before the request could awaited.Add tests for
extras
to validate that both options work. Also, add a method to DiskImport that does not accept cancellation and use that inexecute
.Closes #930