Skip to content
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

Merged
merged 10 commits into from
Jun 15, 2019

Conversation

ramya0820
Copy link
Member

For more context refer to #1751

Copy link
Contributor

@ramya-rao-a ramya-rao-a left a 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

@ramya0820 ramya0820 changed the title Skip initial receive call Update failing tests in EventHubs (misc.spec.ts receiver.spec.ts) Jun 12, 2019
@ramya0820
Copy link
Member Author

ramya0820 commented Jun 12, 2019

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).
Since it seems like we still want to have those in, updated tests with few corrections that I think were needed as well.

@ramya0820
Copy link
Member Author

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.
Those tests identified the same issues issues consistently in browser. But in case of Node, the event loop was masking these sometimes due to likely a certain discrepancy with use of Node event loop framework that needs more investigation (as we have seen different behavior based on which line we add certain code involving network calls and timers).

@ramya0820 ramya0820 requested a review from ShivangiReja June 12, 2019 22:00
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, {
Copy link
Contributor

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

Copy link
Member Author

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;
Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Contributor

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

Copy link
Member Author

@ramya0820 ramya0820 Jun 13, 2019

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

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..

Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Contributor

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

@ramya0820 ramya0820 merged commit 972c84a into Azure:master Jun 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants