Skip to content

Commit

Permalink
[Perf Framework] rename perfstress to perf and runAsync to run (#18290)
Browse files Browse the repository at this point in the history
Reported in #18033.

Basically did a bulk find+replace everywhere. Things _seem_ to be working OK, but wouldn't be surprised if there's something somewhere I've missed, or somewhere where I've replaced something I shouldn't.

I've split the rename of PerfStress -> Perf and runAsync -> run into two commits for ease of review :)
  • Loading branch information
timovv authored Oct 23, 2021
1 parent 58beb3e commit 7a7d99d
Show file tree
Hide file tree
Showing 173 changed files with 540 additions and 567 deletions.
10 changes: 5 additions & 5 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions common/tools/perf-tests-track-1-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Track 1 perf tests are not maintained through rush in this repository.
*
* This helper script is meant to be used to "build" and "install"
* the `@azure/test-utils-perfstress` package in the track-1 perf-test projects
* the `@azure/test-utils-perf` package in the track-1 perf-test projects
* so that the track 1 perf tests can leverage the perf framework.
*
* Additionally, this runs `npm install` in the track-1 perf test projects.
Expand All @@ -21,18 +21,18 @@ function spawn(command) {
}
}

const navigateToPerfStressFolder = `cd ${path.resolve(
const navigateToPerfFolder = `cd ${path.resolve(
"..",
"..",
"..",
"test-utils",
"perfstress"
"perf"
)}`;
const buildPerfStressPackage = `rush build -t test-utils-perfstress`;
const buildPerfPackage = `rush build -t test-utils-perf`;
const rushxPack = `rushx pack`;

console.log(`\nGetting perfstress package...`);
spawn(`${navigateToPerfStressFolder} && ${buildPerfStressPackage} && ${rushxPack}`);
console.log(`\nGetting perf package...`);
spawn(`${navigateToPerfFolder} && ${buildPerfPackage} && ${rushxPack}`);

console.log(`\nRunning "npm install"...`);
spawn(`npm install`);
4 changes: 2 additions & 2 deletions dataplane.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@
"path": "sdk/purview/purview-scanning-rest"
},
{
"name": "perfstress",
"path": "sdk/test-utils/perfstress"
"name": "perf",
"path": "sdk/test-utils/perf"
},
{
"name": "multi-version test",
Expand Down
2 changes: 1 addition & 1 deletion eng/tools/rush-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const reducedDependencyTestMatrix = {
'@azure/storage-blob',
'@azure/template',
'@azure/test-utils',
'@azure/test-utils-perfstress',
'@azure/test-utils-perf',
'@azure-tools/test-recorder',
'@azure/synapse-monitoring'
],
Expand Down
6 changes: 3 additions & 3 deletions rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,8 @@
"versionPolicyName": "utility"
},
{
"packageName": "@azure/test-utils-perfstress",
"projectFolder": "sdk/test-utils/perfstress",
"packageName": "@azure/test-utils-perf",
"projectFolder": "sdk/test-utils/perf",
"versionPolicyName": "utility"
},
{
Expand Down Expand Up @@ -992,4 +992,4 @@
"versionPolicyName": "management"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@azure/app-configuration": "^1.2.0-beta.2",
"@azure/core-http": "^2.0.0",
"@azure/test-utils-perfstress": "^1.0.0",
"@azure/test-utils-perf": "^1.0.0",
"dotenv": "^8.2.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { PerfStressTest, getEnvVar } from "@azure/test-utils-perfstress";
import { PerfTest, getEnvVar } from "@azure/test-utils-perf";
import { AppConfigurationClient } from "@azure/app-configuration";
// Expects the .env file at the same level
import * as dotenv from "dotenv";
dotenv.config();

export abstract class AppConfigTest<TOptions> extends PerfStressTest<TOptions> {
export abstract class AppConfigTest<TOptions> extends PerfTest<TOptions> {
client: AppConfigurationClient;

constructor() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PerfStressProgram, selectPerfStressTest } from "@azure/test-utils-perfstress";
import { PerfProgram, selectPerfTest } from "@azure/test-utils-perf";
import { ListSettingsTest } from "./listSettings.spec";

console.log("=== Starting the perfStress test ===");
console.log("=== Starting the perf test ===");

const perfStressProgram = new PerfStressProgram(selectPerfStressTest([ListSettingsTest]));
const perfProgram = new PerfProgram(selectPerfTest([ListSettingsTest]));

perfStressProgram.run();
perfProgram.run();
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT license.

import { generateUuid } from "@azure/core-http";
import { PerfStressOptionDictionary, executeParallel } from "@azure/test-utils-perfstress";
import { PerfOptionDictionary, executeParallel } from "@azure/test-utils-perf";
import { AppConfigTest } from "./appConfigBase.spec";

interface ListTestOptions {
Expand All @@ -14,7 +14,7 @@ interface ListTestOptions {

export class ListSettingsTest extends AppConfigTest<ListTestOptions> {
static prefix = generateUuid();
public options: PerfStressOptionDictionary<ListTestOptions> = {
public options: PerfOptionDictionary<ListTestOptions> = {
count: {
required: true,
description: "Number of settings to be listed",
Expand All @@ -39,7 +39,7 @@ export class ListSettingsTest extends AppConfigTest<ListTestOptions> {
);
}

async runAsync(): Promise<void> {
async run(): Promise<void> {
for await (const response of this.client
.listConfigurationSettings({ keyFilter: ListSettingsTest.prefix + "*" })
.byPage()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "ISC",
"dependencies": {
"@azure/container-registry": "1.0.0-beta.4",
"@azure/test-utils-perfstress": "^1.0.0",
"@azure/test-utils-perf": "^1.0.0",
"dotenv": "^8.2.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { PerfStressTest, getEnvVar } from "@azure/test-utils-perfstress";
import { PerfTest, getEnvVar } from "@azure/test-utils-perf";
import { ContainerRegistryClient } from "@azure/container-registry";

// Expects the .env file at the same level
import * as dotenv from "dotenv";
dotenv.config();

export abstract class ContainerRegistryTest<TOptions> extends PerfStressTest<TOptions> {
export abstract class ContainerRegistryTest<TOptions> extends PerfTest<TOptions> {
client: ContainerRegistryClient;

constructor() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { PerfStressProgram, selectPerfStressTest } from "@azure/test-utils-perfstress";
import { PerfProgram, selectPerfTest } from "@azure/test-utils-perf";
import { ArtifactListTest } from "./listArtifacts.spec";
import { RepositoryListTest } from "./listRepositories.spec";
console.log("=== Starting the perfStress test ===");
console.log("=== Starting the perf test ===");

const perfStressProgram = new PerfStressProgram(
selectPerfStressTest([RepositoryListTest, ArtifactListTest])
);
perfStressProgram.run();
const perfProgram = new PerfProgram(selectPerfTest([RepositoryListTest, ArtifactListTest]));
perfProgram.run();
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { PerfStressOptionDictionary, getEnvVar } from "@azure/test-utils-perfstress";
import { PerfOptionDictionary, getEnvVar } from "@azure/test-utils-perf";
import { ContainerRepository } from "@azure/container-registry";
import { ContainerRegistryTest, ContainerRegistryTestOptions } from "./client.spec";

export class ArtifactListTest extends ContainerRegistryTest<ContainerRegistryTestOptions> {
repository: ContainerRepository;
public options: PerfStressOptionDictionary<ContainerRegistryTestOptions> = {};
public options: PerfOptionDictionary<ContainerRegistryTestOptions> = {};
constructor() {
super();
this.repository = this.client.getRepository(getEnvVar("REPOSITORY_NAME"));
}

async runAsync(): Promise<void> {
async run(): Promise<void> {
const listIterator = this.repository.listManifestProperties();

for await (const manifest of listIterator) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { PerfStressOptionDictionary } from "@azure/test-utils-perfstress";
import { PerfOptionDictionary } from "@azure/test-utils-perf";
import { ContainerRegistryTest, ContainerRegistryTestOptions } from "./client.spec";

export class RepositoryListTest extends ContainerRegistryTest<ContainerRegistryTestOptions> {
public options: PerfStressOptionDictionary<ContainerRegistryTestOptions> = {};
public options: PerfOptionDictionary<ContainerRegistryTestOptions> = {};
constructor() {
super();
}

async runAsync(): Promise<void> {
async run(): Promise<void> {
const listIterator = this.client.listRepositoryNames();

// eslint-disable-next-line no-empty
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/perf-tests/core-rest-pipeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@azure/core-rest-pipeline": "^1.1.0",
"@azure/core-auth": "^1.3.0",
"@azure/test-utils-perfstress": "^1.0.0",
"@azure/test-utils-perf": "^1.0.0",
"dotenv": "^8.2.0"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PerfStressTest } from "@azure/test-utils-perfstress";
import { PerfTest } from "@azure/test-utils-perf";
import { AccessToken, GetTokenOptions, TokenCredential } from "@azure/core-auth";
import {
AuthorizeRequestOnChallengeOptions,
Expand Down Expand Up @@ -116,7 +116,7 @@ class MockRefreshAzureCredential implements TokenCredential {
}
}

export class BearerTokenAuthenticationPolicyChallengeTest extends PerfStressTest {
export class BearerTokenAuthenticationPolicyChallengeTest extends PerfTest {
options = {};

constructor() {
Expand Down Expand Up @@ -193,7 +193,7 @@ export class BearerTokenAuthenticationPolicyChallengeTest extends PerfStressTest
};
}

async runAsync(): Promise<void> {
async run(): Promise<void> {
const { pipeline, testHttpsClient, request } = BearerTokenAuthenticationPolicyChallengeTest;
await pipeline!.sendRequest(testHttpsClient!, request!);
}
Expand Down
10 changes: 4 additions & 6 deletions sdk/core/perf-tests/core-rest-pipeline/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { PerfStressProgram, selectPerfStressTest } from "@azure/test-utils-perfstress";
import { PerfProgram, selectPerfTest } from "@azure/test-utils-perf";
import { BearerTokenAuthenticationPolicyChallengeTest } from "./bearerTokenChallengeAuthenticationPolicy/wwwChallenge.spec";

console.log("=== Starting the perfStress test ===");
console.log("=== Starting the perf test ===");

const perfStressProgram = new PerfStressProgram(
selectPerfStressTest([BearerTokenAuthenticationPolicyChallengeTest])
);
const perfProgram = new PerfProgram(selectPerfTest([BearerTokenAuthenticationPolicyChallengeTest]));

perfStressProgram.run();
perfProgram.run();
2 changes: 1 addition & 1 deletion sdk/eventgrid/perf-tests/eventgrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "ISC",
"dependencies": {
"@azure/eventgrid": "^4.0.0",
"@azure/test-utils-perfstress": "^1.0.0",
"@azure/test-utils-perf": "^1.0.0",
"dotenv": "^8.2.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions sdk/eventgrid/perf-tests/eventgrid/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { PerfStressProgram, selectPerfStressTest } from "@azure/test-utils-perfstress";
import { PerfProgram, selectPerfTest } from "@azure/test-utils-perf";
import { SendCloudEventsTest } from "./sendCloudEvents.spec";

import dotenv from "dotenv";
dotenv.config();

console.log("=== Starting the perfStress test ===");
console.log("=== Starting the perf test ===");

const perfStressProgram = new PerfStressProgram(selectPerfStressTest([SendCloudEventsTest]));
const perfProgram = new PerfProgram(selectPerfTest([SendCloudEventsTest]));

perfStressProgram.run();
perfProgram.run();
12 changes: 4 additions & 8 deletions sdk/eventgrid/perf-tests/eventgrid/test/sendCloudEvents.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import {
PerfStressTest,
PerfStressOptionDictionary,
getEnvVar
} from "@azure/test-utils-perfstress";
import { PerfTest, PerfOptionDictionary, getEnvVar } from "@azure/test-utils-perf";
import {
EventGridPublisherClient,
AzureKeyCredential,
Expand All @@ -16,8 +12,8 @@ interface SendCloudEventsPerfTestOptions {
"event-count": number;
}

export class SendCloudEventsTest extends PerfStressTest<SendCloudEventsPerfTestOptions> {
options: PerfStressOptionDictionary<SendCloudEventsPerfTestOptions> = {
export class SendCloudEventsTest extends PerfTest<SendCloudEventsPerfTestOptions> {
options: PerfOptionDictionary<SendCloudEventsPerfTestOptions> = {
"event-count": {
required: true,
description: "Number of events to send in a single request",
Expand Down Expand Up @@ -47,7 +43,7 @@ export class SendCloudEventsTest extends PerfStressTest<SendCloudEventsPerfTestO
this.client = new EventGridPublisherClient(endpoint, "CloudEvent", new AzureKeyCredential(key));
}

async runAsync(): Promise<void> {
async run(): Promise<void> {
await this.client.send(this.events);
}
}
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"@azure/identity": "2.0.0-beta.6",
"@azure/mock-hub": "^1.0.0",
"@azure/test-utils": "^1.0.0",
"@azure/test-utils-perfstress": "^1.0.0",
"@azure/test-utils-perf": "^1.0.0",
"@microsoft/api-extractor": "^7.18.11",
"@rollup/plugin-commonjs": "11.0.2",
"@rollup/plugin-inject": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/perf-tests/event-hubs-track-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Create an event-hubs namespace and populate the `.env` file with the following v

> npm run perf-test:node -- SendTest --warmup 2 --duration 7 --parallel 2
_Note: For more default options, refer [Perf-Framework-Default-Options](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/test-utils/perfstress/README.md#keyconcepts)._
_Note: For more default options, refer [Perf-Framework-Default-Options](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/test-utils/perf/README.md#keyconcepts)._

- To test receiving messages (this test does not use the framework, is a standalone test)

Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/perf-tests/event-hubs-track-1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@azure/core-amqp": "^3.0.0",
"@azure/event-hubs": "^2.1.4",
"uuid": "^8.3.0",
"@azure/test-utils-perfstress": "file:../../../test-utils/perfstress/azure-test-utils-perfstress-1.0.0.tgz",
"@azure/test-utils-perf": "file:../../../test-utils/perf/azure-test-utils-perf-1.0.0.tgz",
"dotenv": "^8.2.0",
"moment": "^2.24.0"
},
Expand Down
8 changes: 4 additions & 4 deletions sdk/eventhub/perf-tests/event-hubs-track-1/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { PerfStressProgram, selectPerfStressTest } from "@azure/test-utils-perfstress";
import { PerfProgram, selectPerfTest } from "@azure/test-utils-perf";
import { SendTest } from "./send.spec";

console.log("=== Starting the perfStress test ===");
console.log("=== Starting the perf test ===");

const perfStressProgram = new PerfStressProgram(selectPerfStressTest([SendTest]));
const perfProgram = new PerfProgram(selectPerfTest([SendTest]));

perfStressProgram.run();
perfProgram.run();
Loading

0 comments on commit 7a7d99d

Please sign in to comment.