-
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
Update failing tests in EventHubs (misc.spec.ts receiver.spec.ts) #3709
Conversation
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.
Please see #1751 (comment) as to why skipping the initial receive call will not avoid the case of pending credits
Please see updated PR. My concern was that the tests were doing too many things (additional before and after state checks on eventhub) and could do with testing just the particular usecase (with one send and receive, in which case there wouldn't be any need to deal with pending credits being misused during the test runs). |
Also, these changes would fix root cause for #3471 and #3472 as well which together are same as ones listed in #1751 but for browser. |
await client.send(ed, partitionId); | ||
debug(">>>>>>> Sent the new message after creating the receiver. We should only receive this message."); | ||
const data2 = await breceiver.receive(10, 20); | ||
const data2 = await client.receiveBatch(partitionId, 10, 20, { |
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.
data2 -> data
Same in a few other places
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.
Got it, I was wondering if we should do one round of sole clean / improve, refactor of all eventhub tests PR and keep changes to it? That way we can get past the functional issues for now
@@ -99,27 +94,24 @@ describe("EventHub Receiver", function(): void { | |||
stamp: uid | |||
} | |||
}; | |||
|
|||
const offset = (await client.getPartitionInformation(partitionId)).lastEnqueuedOffset; |
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 particular test is for from end of stream
i.e testing of the event position as returned by EventPosition.fromEnd()
. We have now updated it to use the lastEnqueuedOffset
instead which makes this test identical to the one for after a particular offset
I don't see a way out for this case. Let's comment this test out and add a TODO comment to bring it back as part of #3714
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.
Oh, there might have been a mistake, thanks for the catch!
This should be updated to EventPosition.fromEnd()
and expect to receive 0 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.
Updated
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.
The intent was not to check that receiving from "end of stream" receives 0 messages. The intent was that a receiver created using the EventPosition.fromEnd()
, will receive the messages that were sent after creating the receiver.
This is not possible without having the initial receive()
call because the link is established only when the receive()
call is made.
Therefore, my suggestion in #3709 (comment) was to undo the changes to this test and comment it out
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.
The intent was not to check that receiving from "end of stream" receives 0 messages. The intent was that a receiver created using the
EventPosition.fromEnd()
, will receive the messages that were sent after creating the receiver.This is not possible without having the initial
receive()
call because the link is established only when thereceive()
call is made.Therefore, my suggestion in #3709 (comment) was to undo the changes to this test and comment it out
Oh, okay - will undo and comment out.
Although, I think the basic, happy case test for endOfStream would be that no messages are received when attempted to receive from end of stream. So the first check where inspite of sending (ten) messages to it, we don't receive any seems sufficient. The extra send receive after endOfStream seems extraneous to me, but maybe there's something more going on behind the creation of receiver that's being tested..
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.
Agreed with the basic happy path, but since the intent of the test was more than just the happy path, I would prefer to comment it out.
The main intention of this exercise/PR/issue is to fix the flakiness. As part of the Track 2 work, we will look into increasing test coverage where we will revisit tests and maybe add this happy path.
@@ -197,18 +194,15 @@ describe("EventHub Receiver", function(): void { | |||
}; | |||
await client.send(ed, partitionId); | |||
debug("Sent the new message after creating the receiver. We should only receive this message."); | |||
const data = await breceiver.receive(10, 20); | |||
const data = await client.receiveBatch(partitionId, 10, 20, { | |||
eventPosition: EventPosition.fromOffset(pInfo.lastEnqueuedOffset) |
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.
We are changing what is being tested here.
This should be EventPosition.fromEnqueuedTime(pInfo.lastEnqueuedTimeUtc)
it("'from end of stream' should receive messages correctly ", async function(): Promise<void> { | ||
|
||
// TODO: Enable following test as part of https://github.com/Azure/azure-sdk-for-js/issues/3714 | ||
// After the implementation of BatchingReceiver has been fixed |
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.
After the implementation of BatchingReceiver has been fixed
->
After we ensure the multiple receiveBatch calls on the user facing receiver work as expected
For more context refer to #1751