Skip to content

Commit

Permalink
[Perf] EventHubs SendTest should extend BatchPerfTest (#24516)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeharder authored Jan 18, 2023
1 parent 7acf428 commit 10caad0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sdk/eventhub/perf-tests/event-hubs/test/send.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { getEnvVar, PerfOptionDictionary, PerfTest } from "@azure/test-utils-perf";
import { getEnvVar, PerfOptionDictionary, BatchPerfTest } from "@azure/test-utils-perf";
import { EventHubProducerClient, EventData } from "@azure/event-hubs";

// Expects the .env file at the same level as the "test" folder
Expand All @@ -17,7 +17,7 @@ const connectionString = getEnvVar("EVENTHUB_CONNECTION_STRING");
const eventHubName = getEnvVar("EVENTHUB_NAME");

const producer = new EventHubProducerClient(connectionString, eventHubName);
export class SendTest extends PerfTest<SendTestOptions> {
export class SendTest extends BatchPerfTest<SendTestOptions> {
producer: EventHubProducerClient;
eventBatch: EventData[];
public options: PerfOptionDictionary<SendTestOptions> = {
Expand Down Expand Up @@ -50,7 +50,8 @@ export class SendTest extends PerfTest<SendTestOptions> {
await this.producer.close();
}

async run(): Promise<void> {
async runBatch(): Promise<number> {
await this.producer.sendBatch(this.eventBatch);
return this.eventBatch.length;
}
}

0 comments on commit 10caad0

Please sign in to comment.