Add tests for SDK extras and fix execute#933
Merged
wfchandler merged 3 commits intomainfrom Dec 16, 2024
Merged
Conversation
ahl
reviewed
Dec 3, 2024
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); |
Collaborator
There was a problem hiding this comment.
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.
Collaborator
Author
There was a problem hiding this comment.
That's fair, I've added a run method that doesn't take a cancel channel.
Collaborator
|
Also: worth adding a test here? |
execute
Collaborator
Author
Yes, great point! I've added a high level test for this. |
ahl
approved these changes
Dec 16, 2024
| @@ -0,0 +1,135 @@ | |||
| use httpmock::MockServer; | |||
Collaborator
There was a problem hiding this comment.
Add the license and copyright headers?
Collaborator
Author
There was a problem hiding this comment.
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
Collaborator
Author
|
Rebased to resolve merge conflict. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We've been relying on the CLI disk import tests to cover the
extrasdisk importer in the SDK. However, the CLI does not use theexecutemethod, and we missed that this was failing immediately due to the cancellation sender being dropped before the request could awaited.Add tests for
extrasto validate that both options work. Also, add a method to DiskImport that does not accept cancellation and use that inexecute.Closes #930