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

[Event Hubs] fixes flaky EventProcessor test #4574

Merged
merged 2 commits into from
Jul 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions sdk/eventhub/event-hubs/test/eventProcessor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ describe("Event Processor", function(): void {
}

// set a delay to give a consumers a chance to receive a message
await delay(1000);
await delay(3000);

// shutdown the processor
await processor.stop();
Expand All @@ -230,17 +230,15 @@ describe("Event Processor", function(): void {
processor.start();

// set a delay to give a consumers a chance to receive a message
await delay(1000);
await delay(3000);

await processor.stop();

didError.should.be.false;
// validate correct events captured for each partition
// validate that partitionProcessor methods were called
// do not check events until checkpointing is implemented
for (const partitionId of partitionIds) {
const results = partitionResultsMap.get(partitionId)!;
const events = results.events;
events.length.should.equal(1);
events[0].should.equal(expectedMessagePrefix + partitionId);
results.initialized.should.be.true;
(results.closeReason === CloseReason.Shutdown).should.be.true;
}
Expand Down Expand Up @@ -437,7 +435,9 @@ describe("Event Processor", function(): void {
});

describe("InMemory Partition Manager", function(): void {
it("should claim ownership, get a list of ownership and update checkpoint", async function(): Promise<void> {
it("should claim ownership, get a list of ownership and update checkpoint", async function(): Promise<
void
> {
const inMemoryPartitionManager = new InMemoryPartitionManager();
const partitionOwnership1: PartitionOwnership = {
eventHubName: "myEventHub",
Expand All @@ -458,13 +458,13 @@ describe("Event Processor", function(): void {
partitionOwnership2
]);
partitionOwnership.length.should.equals(2);

const ownershipslist = await inMemoryPartitionManager.listOwnerships(
"myEventHub",
EventHubClient.defaultConsumerGroupName
);
ownershipslist.length.should.equals(2);

const checkpoint: Checkpoint = {
eventHubName: "myEventHub",
consumerGroupName: EventHubClient.defaultConsumerGroupName,
Expand Down