Skip to content

Commit

Permalink
Remove core-http from perf tests (#26276)
Browse files Browse the repository at this point in the history
### Packages impacted by this PR

`@azure-tests/perf-storage-blob`
`@azure-tests/perf-core-rest-pipeline`
`@azure/test-utils-perf`


### Issues associated with this PR

#24525 

### Describe the problem that is addressed by this PR

Remove last references to `core-http` from the tree as it will soon be
deprecated.
  • Loading branch information
xirzec authored Jun 20, 2023
1 parent 3db56eb commit 2d25e3d
Show file tree
Hide file tree
Showing 22 changed files with 31 additions and 315 deletions.
2 changes: 0 additions & 2 deletions sdk/core/perf-tests/core-rest-pipeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"@azure/core-http": "^3.0.0",
"@azure/core-rest-pipeline": "^1.1.0",
"@azure/core-auth": "^1.3.0",
"@azure/test-utils-perf": "^1.0.0",
Expand All @@ -17,7 +16,6 @@
},
"devDependencies": {
"@types/node": "^16.0.0",
"@types/uuid": "^8.0.0",
"@types/express": "^4.17.13",
"concurrently": "^6.2.1",
"cross-env": "^7.0.3",
Expand Down
38 changes: 0 additions & 38 deletions sdk/core/perf-tests/core-rest-pipeline/test/core-http.spec.ts

This file was deleted.

2 changes: 0 additions & 2 deletions sdk/core/perf-tests/core-rest-pipeline/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { createPerfProgram } from "@azure/test-utils-perf";
import { BearerTokenAuthenticationPolicyChallengeTest } from "./bearerTokenChallengeAuthenticationPolicy/wwwChallenge.spec";
import { CoreHTTPTest } from "./core-http.spec";
import { CoreRestPipelineTest } from "./core-rest-pipeline.spec";
import { FetchTest } from "./fetch.spec";
import { HttpRequestTest } from "./http-request.spec";
import { UndiciRequestTest } from "./undici-request.spec";

const perfProgram = createPerfProgram(
BearerTokenAuthenticationPolicyChallengeTest,
CoreHTTPTest,
CoreRestPipelineTest,
FetchTest,
HttpRequestTest,
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/perf-tests/storage-blob/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"author": "",
"license": "ISC",
"dependencies": {
"@azure/core-http": "^3.0.0",
"@azure/core-rest-pipeline": "^1.1.0",
"@azure/storage-blob": "^12.12.0-beta.2",
"@azure/core-util": "^1.3.2",
"@azure/storage-blob": "^12.20.0",
"@azure/test-utils-perf": "^1.0.0",
"dotenv": "^16.0.0",
"uuid": "^8.3.0"
Expand Down
35 changes: 0 additions & 35 deletions sdk/storage/perf-tests/storage-blob/test/core-http.spec.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
BlobClient,
} from "@azure/storage-blob";
import { getValueInConnString } from "./utils/utils";
import { generateUuid } from "@azure/core-http";
import { randomUUID } from "@azure/core-util";

interface StorageBlobDownloadTestOptions {
size: number;
Expand All @@ -27,7 +27,7 @@ export class StorageBlobDownloadWithSASTest extends StorageBlobTest<StorageBlobD
},
};

static blobName = generateUuid();
static blobName = randomUUID();
blockBlobClient: BlockBlobClient;
blobClientFromSAS: BlobClient;
sasUrl: string;
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/perf-tests/storage-blob/test/download.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { drainStream, PerfOptionDictionary } from "@azure/test-utils-perf";
import { StorageBlobTest } from "./storageTest.spec";
import { BlockBlobClient } from "@azure/storage-blob";
import { generateUuid } from "@azure/core-http";
import { randomUUID } from "@azure/core-util";

interface StorageBlobDownloadTestOptions {
size: number;
Expand All @@ -21,7 +21,7 @@ export class StorageBlobDownloadTest extends StorageBlobTest<StorageBlobDownload
},
};

static blobName = generateUuid();
static blobName = randomUUID();
blockBlobClient: BlockBlobClient;

constructor() {
Expand Down
2 changes: 0 additions & 2 deletions sdk/storage/perf-tests/storage-blob/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { StorageBlobUploadTest } from "./upload.spec";
import { StorageBlobUploadFileTest } from "./uploadFromFile.spec";
import { StorageBlobListTest } from "./listBlobs.spec";
import { StorageBlobDownloadWithSASTest } from "./dowloadWithSAS.spec";
import { CoreHTTPDownloadWithSASTest } from "./core-http.spec";
import { NodeFetchDownloadWithSASTest } from "./node-fetch.spec";
import { CoreHTTPSDownloadWithSASTest } from "./core-rest-pipeline.spec";

Expand All @@ -17,7 +16,6 @@ const perfProgram = createPerfProgram(
StorageBlobUploadFileTest,
StorageBlobListTest,
StorageBlobDownloadWithSASTest,
CoreHTTPDownloadWithSASTest,
CoreHTTPSDownloadWithSASTest,
NodeFetchDownloadWithSASTest
);
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/perf-tests/storage-blob/test/listBlobs.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 { generateUuid } from "@azure/core-http";
import { randomUUID } from "@azure/core-util";
import { PerfOptionDictionary, executeParallel } from "@azure/test-utils-perf";
import { StorageBlobTest } from "./storageTest.spec";
interface StorageBlobListTestOptions {
Expand All @@ -22,7 +22,7 @@ export class StorageBlobListTest extends StorageBlobTest<StorageBlobListTestOpti
await super.globalSetup();
await executeParallel(
async (_count: number, _parallelIndex: number) => {
await this.containerClient.uploadBlockBlob(generateUuid(), Buffer.alloc(0), 0);
await this.containerClient.uploadBlockBlob(randomUUID(), Buffer.alloc(0), 0);
},
this.parsedOptions.count.value!,
32
Expand Down
15 changes: 9 additions & 6 deletions sdk/storage/perf-tests/storage-blob/test/storageTest.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 { generateUuid } from "@azure/core-http";
import { randomUUID } from "@azure/core-util";
import { PerfTest, getEnvVar } from "@azure/test-utils-perf";
import {
BlobServiceClient,
Expand All @@ -18,7 +18,7 @@ export abstract class StorageBlobTest<TOptions> extends PerfTest<TOptions> {
blobServiceClient: BlobServiceClient;
containerClient: ContainerClient;
sharedKeyCredential: StorageSharedKeyCredential;
static containerName = generateUuid();
static containerName = randomUUID();

constructor() {
super();
Expand All @@ -27,10 +27,13 @@ export abstract class StorageBlobTest<TOptions> extends PerfTest<TOptions> {
getValueInConnString(connectionString, "AccountName"),
getValueInConnString(connectionString, "AccountKey")
);
this.blobServiceClient = BlobServiceClient.fromConnectionString(
connectionString,
this.configureClientOptionsCoreV1({})
);
this.blobServiceClient = BlobServiceClient.fromConnectionString(connectionString);
const options = this.configureClientOptions({ additionalPolicies: [] });

const pipeline = this.blobServiceClient["storageClientContext"].pipeline;
for (const { policy } of options.additionalPolicies ?? []) {
pipeline.addPolicy(policy, { afterPhase: "Sign" });
}
this.containerClient = this.blobServiceClient.getContainerClient(StorageBlobTest.containerName);
}

Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/perf-tests/storage-blob/test/upload.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 { generateUuid } from "@azure/core-http";
import { randomUUID } from "@azure/core-util";
import { PerfOptionDictionary } from "@azure/test-utils-perf";
import { StorageBlobTest } from "./storageTest.spec";

Expand All @@ -24,7 +24,7 @@ export class StorageBlobUploadTest extends StorageBlobTest<StorageBlobUploadTest

constructor() {
super();
this.blobName = generateUuid();
this.blobName = randomUUID();
this.buffer = Buffer.alloc(this.parsedOptions.size.value!);
}

Expand Down
3 changes: 1 addition & 2 deletions sdk/test-utils/perf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@
"private": true,
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/core-http": "^3.0.0",
"@azure/core-rest-pipeline": "^1.1.0",
"@azure/core-util": "^1.1.0",
"@azure/core-util": "^1.3.2",
"tslib": "^2.2.0",
"node-fetch": "^2.6.6",
"minimist": "^1.2.8",
Expand Down
33 changes: 2 additions & 31 deletions sdk/test-utils/perf/src/batchPerfTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
// Licensed under the MIT license.

import { AbortSignalLike, AbortController } from "@azure/abort-controller";
import {
TestProxyHttpClient,
TestProxyHttpClientV1,
testProxyHttpPolicy,
} from "./testProxyHttpClient";
import { HttpClient } from "@azure/core-http";
import { TestProxyHttpClient, testProxyHttpPolicy } from "./testProxyHttpClient";
import { PerfTestBase } from "./perfTestBase";
import { AdditionalPolicyConfig } from "@azure/core-client";

Expand All @@ -19,7 +14,6 @@ export abstract class BatchPerfTest<
> extends PerfTestBase<TOptions> {
private readonly testProxy!: string;
public testProxyHttpClient!: TestProxyHttpClient;
public testProxyHttpClientV1!: TestProxyHttpClientV1;

public constructor() {
super();
Expand All @@ -32,25 +26,6 @@ export abstract class BatchPerfTest<

public abstract runBatch(abortSignal?: AbortSignalLike): Promise<number>;

/**
* configureClientOptionsCoreV1
*
* For core-v1 - libraries depending on core-http
* Apply this method on the client options to get the proxy tool support
*
* Note: httpClient must be part of the options bag, it is required for the perf framework to update the underlying client properly
*/
public configureClientOptionsCoreV1<T>(options: T & { httpClient?: HttpClient }): T {
if (this.testProxy) {
this.testProxyHttpClientV1 = new TestProxyHttpClientV1(
this.testProxy,
this.parsedOptions["insecure"].value
);
options.httpClient = this.testProxyHttpClientV1;
}
return options;
}

/**
* configureClientOptions
*
Expand Down Expand Up @@ -167,11 +142,9 @@ export abstract class BatchPerfTest<
// => call the run method
// => stop record
// => start playback
let recorder: TestProxyHttpClientV1 | TestProxyHttpClient;
let recorder: TestProxyHttpClient;
if (this.testProxyHttpClient) {
recorder = this.testProxyHttpClient;
} else if (this.testProxyHttpClientV1) {
recorder = this.testProxyHttpClientV1;
} else {
throw new Error(
"testProxyClient is not set, please make sure the client/options are configured properly."
Expand All @@ -193,8 +166,6 @@ export abstract class BatchPerfTest<
private async stopPlayback() {
if (this.testProxyHttpClient) {
await this.testProxyHttpClient.stopPlayback();
} else if (this.testProxyHttpClientV1) {
await this.testProxyHttpClientV1.stopPlayback();
}
}
}
1 change: 0 additions & 1 deletion sdk/test-utils/perf/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export { PerfTest } from "./perfTest";
export { BatchPerfTest } from "./batchPerfTest";
export { EventPerfTest } from "./eventPerfTest";
export * from "./options";
export * from "./policy";
export * from "./program";
export * from "./parallel";
export { getEnvVar, drainStream } from "./utils/utils";
53 changes: 0 additions & 53 deletions sdk/test-utils/perf/src/policy.ts

This file was deleted.

Loading

0 comments on commit 2d25e3d

Please sign in to comment.