[Perf Tests] Update perf test projects to use the perf-test sdk-type (#16927)
* Update sdk-type * update Getting Started * rushx format * rush format * update commands * Update sdk/storage/perf-tests/storage-blob-track-1/package.json * Update sdk/storage/perf-tests/storage-blob-track-1/package.json * Update sdk/storage/perf-tests/storage-file-share-track-1/package.json * Update sdk/storage/perf-tests/storage-file-share-track-1/package.json
This commit is contained in:
Родитель
ca94e95c67
Коммит
3483187063
|
@ -27,7 +27,7 @@ export const baseCommand = async (...args: string[]) => {
|
|||
const status = await subCommand(baseCommandInfo, baseCommands)(...args);
|
||||
|
||||
if (!status) {
|
||||
log.error("Errors occured. See the output above.")
|
||||
log.error("Errors occured. See the output above.");
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -365,7 +365,7 @@ async function makeSampleGenerationInfo(
|
|||
),
|
||||
computeSampleDependencies(outputKind: OutputKind) {
|
||||
// Store the `@types/*` packages the TS samples might need.
|
||||
const typesDependencies: {[packageName: string]: string} = {};
|
||||
const typesDependencies: { [packageName: string]: string } = {};
|
||||
return {
|
||||
dependencies: moduleInfos.reduce((prev, source) => {
|
||||
const current: Record<string, string> = {};
|
||||
|
|
|
@ -27,7 +27,9 @@ describe("Project Resolution", async () => {
|
|||
// Replacement below is required because of escaping. A single backslash is
|
||||
// interpreted as an escape character in the RegExp compiler, but we need
|
||||
// it to be interpreted _literally_ in windows file paths, so we double-escape them.
|
||||
new RegExp(`.*${(path.sep + path.join("common", "tools", "dev-tool")).replace(/\\/g, "\\\\")}`)
|
||||
new RegExp(
|
||||
`.*${(path.sep + path.join("common", "tools", "dev-tool")).replace(/\\/g, "\\\\")}`
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-app-configuration",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
@ -30,9 +31,9 @@
|
|||
"build": "tsc -p .",
|
||||
"build:samples": "echo skipped",
|
||||
"build:test": "echo skipped",
|
||||
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"check-format": "prettier --list-different --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"clean": "rimraf dist dist-esm test-dist typings *.tgz *.log",
|
||||
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"format": "prettier --write --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"integration-test:browser": "echo skipped",
|
||||
"integration-test:node": "echo skipped",
|
||||
"integration-test": "echo skipped",
|
||||
|
|
|
@ -43,7 +43,7 @@ export class ListSettingsTest extends AppConfigTest<ListTestOptions> {
|
|||
for await (const response of this.client
|
||||
.listConfigurationSettings({ keyFilter: ListSettingsTest.prefix + "*" })
|
||||
.byPage()) {
|
||||
// eslint-disable-next-line no-empty
|
||||
// eslint-disable-next-line no-empty
|
||||
for (const _ of response.items) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,14 +3,9 @@
|
|||
"compilerOptions": {
|
||||
"module": "CommonJS",
|
||||
"declarationDir": "./typings/latest",
|
||||
"lib": [
|
||||
"ES6",
|
||||
"ESNext.AsyncIterable"
|
||||
],
|
||||
"lib": ["ES6", "ESNext.AsyncIterable"],
|
||||
"noEmit": true
|
||||
},
|
||||
"compileOnSave": true,
|
||||
"include": [
|
||||
"./test/**/*.ts"
|
||||
]
|
||||
"include": ["./test/**/*.ts"]
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-core-rest-pipeline",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0-beta.1",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-eventgrid",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-ai-form-recognizer",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "Performance Tests for @azure/ai-form-recognizer",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-identity",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0-beta.1",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-keyvault-certificates",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-keyvault-keys",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-keyvault-secrets",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-ai-metrics-advisor",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-search-documents",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
import { Hotel } from "./hotel";
|
||||
|
||||
export function generateHotels(documentsCount: number):Hotel[] {
|
||||
const hotels:Hotel[] = [];
|
||||
for(let i = 0; i < documentsCount; i++) {
|
||||
export function generateHotels(documentsCount: number): Hotel[] {
|
||||
const hotels: Hotel[] = [];
|
||||
for (let i = 0; i < documentsCount; i++) {
|
||||
hotels.push(createHotel(i));
|
||||
}
|
||||
return hotels;
|
||||
}
|
||||
|
||||
function createHotel(hotelId: number): Hotel {
|
||||
const hotel:Hotel = {
|
||||
const hotel: Hotel = {
|
||||
hotelId: hotelId.toString(),
|
||||
hotelName: "Secret Point Motel",
|
||||
description: "The hotel is ideally located on the main commercial artery of the city in the heart of New York. A few minutes away is Time's Square and the historic centre of the city, as well as other places of interest that make New York one of America's most attractive and cosmopolitan cities.",
|
||||
descriptionFr: "L'hôtel est idéalement situé sur la principale artère commerciale de la ville en plein cœur de New York. A quelques minutes se trouve la place du temps et le centre historique de la ville, ainsi que d'autres lieux d'intérêt qui font de New York l'une des villes les plus attractives et cosmopolites de l'Amérique.",
|
||||
description:
|
||||
"The hotel is ideally located on the main commercial artery of the city in the heart of New York. A few minutes away is Time's Square and the historic centre of the city, as well as other places of interest that make New York one of America's most attractive and cosmopolitan cities.",
|
||||
descriptionFr:
|
||||
"L'hôtel est idéalement situé sur la principale artère commerciale de la ville en plein cœur de New York. A quelques minutes se trouve la place du temps et le centre historique de la ville, ainsi que d'autres lieux d'intérêt qui font de New York l'une des villes les plus attractives et cosmopolites de l'Amérique.",
|
||||
category: "Boutique",
|
||||
tags: ["pool", "air conditioning", "concierge"],
|
||||
parkingIncluded: false,
|
||||
|
@ -26,6 +28,6 @@ function createHotel(hotelId: number): Hotel {
|
|||
country: "USA",
|
||||
postalCode: "10022"
|
||||
}
|
||||
}
|
||||
};
|
||||
return hotel;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import {
|
||||
GeographyPoint
|
||||
} from "@azure/search-documents";
|
||||
import { GeographyPoint } from "@azure/search-documents";
|
||||
|
||||
export interface Hotel {
|
||||
hotelId: string;
|
||||
|
|
|
@ -13,7 +13,9 @@ export interface SearchDocumentsTestOptions {
|
|||
documentsCount: number;
|
||||
}
|
||||
|
||||
export abstract class SearchDocumentsBase<TOptions = Record<string, unknown>> extends PerfStressTest<TOptions> {
|
||||
export abstract class SearchDocumentsBase<
|
||||
TOptions = Record<string, unknown>
|
||||
> extends PerfStressTest<TOptions> {
|
||||
searchIndexClient: SearchIndexClient;
|
||||
searchClient: SearchClient<Hotel>;
|
||||
indexName: string;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the MIT license.
|
||||
|
||||
import { PerfStressProgram, selectPerfStressTest } from "@azure/test-utils-perfstress";
|
||||
import { AutoCompleteTest } from "./autoCompleteTest.spec"
|
||||
import { AutoCompleteTest } from "./autoCompleteTest.spec";
|
||||
import { IndexDocumentsTest } from "./indexDocumentsTest.spec";
|
||||
import { SearchDocumentsTest } from "./searchDocumentsTest.spec";
|
||||
import { SuggestTest } from "./suggestTest.spec";
|
||||
|
@ -12,6 +12,8 @@ dotenv.config();
|
|||
|
||||
console.log("=== Starting the perfStress test ===");
|
||||
|
||||
const perfStressProgram = new PerfStressProgram(selectPerfStressTest([AutoCompleteTest, IndexDocumentsTest, SearchDocumentsTest, SuggestTest]));
|
||||
const perfStressProgram = new PerfStressProgram(
|
||||
selectPerfStressTest([AutoCompleteTest, IndexDocumentsTest, SearchDocumentsTest, SuggestTest])
|
||||
);
|
||||
|
||||
perfStressProgram.run();
|
||||
|
|
|
@ -22,8 +22,10 @@ export class IndexDocumentsTest extends SearchDocumentsBase<SearchDocumentsTestO
|
|||
}
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
for(let i = 0; i < this.hotels.length; i++) {
|
||||
this.hotels[i].hotelId = (Math.floor(Math.random() * ((this.hotels.length * 2) - this.hotels.length + 1) + this.hotels.length)).toString();
|
||||
for (let i = 0; i < this.hotels.length; i++) {
|
||||
this.hotels[i].hotelId = Math.floor(
|
||||
Math.random() * (this.hotels.length * 2 - this.hotels.length + 1) + this.hotels.length
|
||||
).toString();
|
||||
}
|
||||
const batch: IndexDocumentsBatch<Hotel> = new IndexDocumentsBatch<Hotel>();
|
||||
batch.upload(this.hotels);
|
||||
|
|
|
@ -22,6 +22,6 @@ export class SuggestTest extends SearchDocumentsBase<SearchDocumentsTestOptions>
|
|||
}
|
||||
|
||||
async runAsync(): Promise<void> {
|
||||
await this.searchClient.suggest("historic", this.suggesterName)
|
||||
await this.searchClient.suggest("historic", this.suggesterName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,17 +4,10 @@
|
|||
"module": "CommonJS",
|
||||
"target": "ES2015",
|
||||
"declarationDir": "./types",
|
||||
"lib": [
|
||||
"ES6",
|
||||
"ESNext.AsyncIterable"
|
||||
],
|
||||
"lib": ["ES6", "ESNext.AsyncIterable"],
|
||||
"noEmit": true,
|
||||
"outDir": "./dist-esm"
|
||||
},
|
||||
"include": [
|
||||
"./test/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
"include": ["./test/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-storage-blob-track-1",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
@ -24,9 +25,9 @@
|
|||
"build": "tsc -p .",
|
||||
"build:samples": "echo skipped",
|
||||
"build:test": "echo skipped",
|
||||
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"check-format": "prettier --list-different --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"clean": "rimraf dist dist-* typings *.tgz *.log",
|
||||
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"format": "prettier --write --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"integration-test:browser": "echo skipped",
|
||||
"integration-test:node": "echo skipped",
|
||||
"integration-test": "echo skipped",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-storage-blob",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -27,7 +27,10 @@ export abstract class StorageBlobTest<TOptions> extends PerfStressTest<TOptions>
|
|||
getValueInConnString(connectionString, "AccountName"),
|
||||
getValueInConnString(connectionString, "AccountKey")
|
||||
);
|
||||
this.blobServiceClient = BlobServiceClient.fromConnectionString(connectionString, this.configureClientOptionsCoreV1({}));
|
||||
this.blobServiceClient = BlobServiceClient.fromConnectionString(
|
||||
connectionString,
|
||||
this.configureClientOptionsCoreV1({})
|
||||
);
|
||||
this.containerClient = this.blobServiceClient.getContainerClient(StorageBlobTest.containerName);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-storage-file-datalake",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-storage-file-share-track-1",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
@ -25,9 +26,9 @@
|
|||
"build": "tsc -p .",
|
||||
"build:samples": "echo skipped",
|
||||
"build:test": "echo skipped",
|
||||
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"check-format": "prettier --list-different --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"clean": "rimraf dist dist-* typings *.tgz *.log",
|
||||
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"format": "prettier --write --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
||||
"integration-test:browser": "echo skipped",
|
||||
"integration-test:node": "echo skipped",
|
||||
"integration-test": "echo skipped",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-storage-file-share",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-data-tables",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
|
@ -9,7 +9,9 @@ export abstract class TablesTest<TOptions = Record<string, unknown>> extends Per
|
|||
constructor(tableName: string) {
|
||||
super();
|
||||
const connectionString = getEnvVar("SAS_CONNECTION_STRING");
|
||||
this.client = this.configureClient(TableClient.fromConnectionString(connectionString, tableName));
|
||||
this.client = this.configureClient(
|
||||
TableClient.fromConnectionString(connectionString, tableName)
|
||||
);
|
||||
}
|
||||
|
||||
public async globalSetup() {
|
||||
|
|
|
@ -38,7 +38,7 @@ To add perf tests for the `sdk/<service>/<service-sdk>` package, follow the step
|
|||
```
|
||||
|
||||
3. Tests will live under `sdk/<service>/perf-tests/<service-sdk>/test`
|
||||
4. Add a `package.json` such as [example-perf-package.json](https://github.com/Azure/azure-sdk-for-js/blob/fe9b1e5a50946f53b6491d7f67b2420d8ee1b229/sdk/storage/perf-tests/storage-file-datalake/package.json) at `sdk/<service>/perf-tests/<service-sdk>` folder.
|
||||
4. Add a `package.json` such as [example-perf-package.json](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/perf-tests/storage-file-datalake/package.json) at `sdk/<service>/perf-tests/<service-sdk>` folder.
|
||||
|
||||
Make sure to import your `<service-sdk>` and the `test-utils-perfstress` project.
|
||||
|
||||
|
@ -55,6 +55,7 @@ To add perf tests for the `sdk/<service>/<service-sdk>` package, follow the step
|
|||
|
||||
```json
|
||||
"name": "@azure-tests/perf-<service-sdk>",
|
||||
"sdk-type": "perf-test",
|
||||
"private": true,
|
||||
```
|
||||
|
||||
|
@ -69,19 +70,17 @@ To add perf tests for the `sdk/<service>/<service-sdk>` package, follow the step
|
|||
In the end, your tsconfig may look something like below.
|
||||
|
||||
```
|
||||
{
|
||||
"extends": "../../../../tsconfig.package",
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS",
|
||||
"target": "ES2015",
|
||||
"declarationDir": "./typings/latest",
|
||||
"lib": ["ES6", "ESNext.AsyncIterable"],
|
||||
"noEmit": true
|
||||
},
|
||||
"compileOnSave": true,
|
||||
"exclude": ["node_modules"],
|
||||
"include": ["./test/**/*.ts"]
|
||||
}
|
||||
{
|
||||
"extends": "../../../../tsconfig.package",
|
||||
"compilerOptions": {
|
||||
"module": "CommonJS",
|
||||
"declarationDir": "./typings/latest",
|
||||
"lib": ["ES6", "ESNext.AsyncIterable"],
|
||||
"noEmit": true
|
||||
},
|
||||
"compileOnSave": true,
|
||||
"include": ["./test/**/*.ts"]
|
||||
}
|
||||
```
|
||||
|
||||
### [For perf-testing track 1 version of the same package](#for-perf-testing-track-1-version-of-the-same-package)
|
||||
|
@ -107,6 +106,7 @@ To add perf tests for the `sdk/<service>/<service-sdk>` package, follow the step
|
|||
|
||||
```json
|
||||
"name": "@azure-tests/perf-<service-sdk>-track-1",
|
||||
"sdk-type": "perf-test"
|
||||
"private": true,
|
||||
```
|
||||
|
||||
|
@ -260,7 +260,7 @@ Example: Currently `@azure/<service-sdk>` is at 12.4.0 on master and you want to
|
|||
- `"@azure/<service-sdk>": [..., "12.2.0"]`
|
||||
- `rush update` (generates a new pnpm-lock file)
|
||||
- Navigate to `sdk\storage\perf-tests\<service-sdk>`
|
||||
- `rush build -t perf-test-<service-sdk>`
|
||||
- `rush build -t perf-<service-sdk>`
|
||||
- Run the tests as suggested before, example `npm run perf-test:node -- TestClassName --warmup 2 --duration 7 --iterations 2 --parallel 50`
|
||||
|
||||
## [Using Proxy Tool](#using-proxy-tool)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "@azure-tests/perf-ai-text-analytics",
|
||||
"sdk-type": "perf-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "",
|
||||
|
|
Загрузка…
Ссылка в новой задаче