-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[event-hubs] add tests for cancellation #15094
Conversation
/azp run js - event-hubs - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
await client.initialize({ abortSignal, timeoutInMs: 60000 }); | ||
throw new Error(TEST_FAILURE); | ||
} catch (err) { | ||
should.equal(err.name, "AbortError"); |
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.
Not fatal for this PR but it's sometimes nice to compare the message and name together (so if it fails you have the actual exception that got thrown).
Perhaps that's not as easy with the 'should' API as it would be with just assert.deepEqual({
name: err.name,
message: err.message
}, {
name: "AbortError",
message: "The operation was aborted."
})
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.
Yeah, this is definitely less easy using should
. Maybe an MQ task will be moving to assert...
const messages = [...errors].map((e) => e.message); | ||
messages.sort(); | ||
console.dir(messages); |
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.
Oops!
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 don't see any tests for subscribe() specifically. Does it not support abort signals or is there some other logic that covers it?
Subscribe does not support abortSignals. The way to stop it is to call close on either the object returned by the subscribe call, or the EventHubConsumerClient. |
Updated examples to use non-global locations and added new flags (Azure#15094) Co-authored-by: Avi Jerafi <[email protected]>
Fixes #4422
Also address #13504 for event hubs by adding tests on the EventHubSender.send method.
The abort signal was plumbed through all the
init
operations to fix a separate bug as part of #14844 and was released in event-hubs version 5.5.1.This PR ensures we have cancellation tests for all of our public methods and internal init/send/receive methods.