[engsys] remove `node-fetch` perf tests (#28152)
As we removed core-http and Fetch api is being added into NodeJS, node-fetch is no longer relevant. Now it is only used in perf tests. This PR removes node-fetch dependency and its perf tests. while at it I also removed stale references to core-http.
This commit is contained in:
Родитель
43b5718630
Коммит
8ed35e7a14
|
@ -67,10 +67,6 @@
|
|||
"name": "agrifood-farming",
|
||||
"path": "sdk/agrifood/agrifood-farming-rest"
|
||||
},
|
||||
{
|
||||
"name": "core-http",
|
||||
"path": "sdk/core/core-http"
|
||||
},
|
||||
{
|
||||
"name": "core-rest-pipeline",
|
||||
"path": "sdk/core/core-rest-pipeline"
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
- `bearerTokenAuthenticationPolicy` test for the `challengeCallbacks`, for simple `WWW-Authenticate` challenges.
|
||||
- `npm run perf-test:node -- BearerTokenAuthenticationPolicyChallengeTest --warmup 1 --iterations 1 --parallel 5`
|
||||
- Comparing various HTTP clients...
|
||||
- `npm run perf-test:node -- FetchTest --warmup 1 --iterations 1 --parallel 5` [ 6,693.39 ops/sec ]
|
||||
- `npm run perf-test:node -- UndiciRequestTest --warmup 1 --iterations 1 --parallel 5` [ 19,733.93 ops/sec ]
|
||||
- `npm run perf-test:node -- CoreRestPipelineTest --warmup 1 --iterations 1 --parallel 5` [ 17,519.69 ops/sec]
|
||||
- `npm run perf-test:node -- CoreHTTPTest --warmup 1 --iterations 1 --parallel 5` [ 4,498.91 ops/sec]
|
||||
- `npm run perf-test:node -- HttpRequestTest --warmup 1 --iterations 1 --parallel 5` [ 19,632.64 ops/sec]
|
||||
[ -- number ops/sec -- ] are from a codespaces instance
|
||||
|
|
|
@ -15,11 +15,7 @@
|
|||
- `npm run perf-test:node -- StorageBlobListTest --warmup 2 --duration 7 --iterations 2 --parallel 2`
|
||||
- download using sas with storage-blob
|
||||
- `npm run perf-test:node -- StorageBlobDownloadWithSASTest --warmup 2 --duration 7 --iterations 2 --parallel 2`
|
||||
- download using sas with node-fetch
|
||||
- `npm run perf-test:node -- NodeFetchDownloadWithSASTest --warmup 2 --duration 7 --iterations 2 --parallel 2`
|
||||
- download using sas with core-http
|
||||
- `npm run perf-test:node -- CoreHTTPDownloadWithSASTest --warmup 2 --duration 7 --iterations 2 --parallel 2`
|
||||
- download using sas with core-rest-pipeline
|
||||
- `npm run perf-test:node -- CoreHTTPSDownloadWithSASTest --warmup 2 --duration 7 --iterations 2 --parallel 2`
|
||||
- download test with profiling
|
||||
- `npm run perf-test:node -- StorageBlobDownloadTest --duration 10 --profile --parallel 64`
|
||||
- `npm run perf-test:node -- StorageBlobDownloadTest --duration 10 --profile --parallel 64`
|
||||
|
|
|
@ -16,9 +16,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.0.0",
|
||||
"@types/node-fetch": "^2.5.0",
|
||||
"eslint": "^8.0.0",
|
||||
"node-fetch": "^2.6.6",
|
||||
"prettier": "^2.5.1",
|
||||
"rimraf": "^3.0.0",
|
||||
"tslib": "^2.2.0",
|
||||
|
|
|
@ -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 { NodeFetchDownloadWithSASTest } from "./node-fetch.spec";
|
||||
import { CoreHTTPSDownloadWithSASTest } from "./core-rest-pipeline.spec";
|
||||
|
||||
const perfProgram = createPerfProgram(
|
||||
|
@ -17,7 +16,6 @@ const perfProgram = createPerfProgram(
|
|||
StorageBlobListTest,
|
||||
StorageBlobDownloadWithSASTest,
|
||||
CoreHTTPSDownloadWithSASTest,
|
||||
NodeFetchDownloadWithSASTest
|
||||
);
|
||||
|
||||
perfProgram.run();
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import { StorageBlobDownloadWithSASTest } from "./dowloadWithSAS.spec";
|
||||
import node_fetch from "node-fetch";
|
||||
import https from "https";
|
||||
import { drainStream } from "@azure/test-utils-perf";
|
||||
export class NodeFetchDownloadWithSASTest extends StorageBlobDownloadWithSASTest {
|
||||
agent: https.Agent;
|
||||
constructor() {
|
||||
super();
|
||||
this.agent = new https.Agent({ keepAlive: true });
|
||||
}
|
||||
|
||||
async run(): Promise<void> {
|
||||
const response = await node_fetch(this.sasUrl, { agent: this.agent });
|
||||
await drainStream(response.body);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
import { PerfOptionDictionary, drainStream } from "@azure/test-utils-perf";
|
||||
import { Aborter, FileURL } from "@azure/storage-file";
|
||||
import { StorageFileShareTest } from "./storageTest";
|
||||
import { generateUuid } from "@azure/core-http";
|
||||
import { generateUuid } from "@azure/core-util";
|
||||
|
||||
interface StorageFileShareDownloadTestOptions {
|
||||
size: number;
|
||||
|
|
|
@ -13,7 +13,7 @@ import {
|
|||
|
||||
// Expects the .env file at the same level as the "test" folder
|
||||
import * as dotenv from "dotenv";
|
||||
import { generateUuid } from "@azure/core-http";
|
||||
import { generateUuid } from "@azure/core-util";
|
||||
dotenv.config();
|
||||
|
||||
export abstract class StorageFileShareTest<TOptions> extends PerfTest<TOptions> {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import { PerfOptionDictionary } from "@azure/test-utils-perf";
|
||||
import { Aborter, FileURL } from "@azure/storage-file";
|
||||
import { StorageFileShareTest } from "./storageTest";
|
||||
import { generateUuid } from "@azure/core-http";
|
||||
import { generateUuid } from "@azure/core-util";
|
||||
|
||||
interface StorageFileShareUploadTestOptions {
|
||||
size: number;
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
"@azure/core-rest-pipeline": "^1.1.0",
|
||||
"@azure/core-util": "^1.3.2",
|
||||
"tslib": "^2.2.0",
|
||||
"node-fetch": "^2.6.6",
|
||||
"minimist": "^1.2.8",
|
||||
"@types/minimist": "^1.2.2",
|
||||
"fs-extra": "^10.0.0"
|
||||
|
@ -72,7 +71,6 @@
|
|||
"@azure/core-client": "^1.3.1",
|
||||
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
||||
"@types/node": "^18.0.0",
|
||||
"@types/node-fetch": "^2.5.0",
|
||||
"eslint": "^8.0.0",
|
||||
"karma": "^6.2.0",
|
||||
"karma-chrome-launcher": "^3.0.0",
|
||||
|
|
|
@ -6,7 +6,6 @@ import { OptionsTest } from "./options.spec";
|
|||
import { SetupCleanupTest } from "./setupCleanup.spec";
|
||||
import { Exception } from "./exception.spec";
|
||||
import { SleepTest } from "./sleep.spec";
|
||||
import { NodeFetchTest } from "./nodeFetch.spec";
|
||||
import { MockReceiverTest } from "./batch/mockReceiverTest.spec";
|
||||
import { MockEventReceiverTest } from "./event/mockEventReceiverTest.spec";
|
||||
import { MockEventHubConsumerClientTest } from "./event/mockEventHubConsumerClientTest.spec";
|
||||
|
@ -26,7 +25,6 @@ const tests: TestDefinition[] = [
|
|||
SetupCleanupTest,
|
||||
Exception,
|
||||
SleepTest,
|
||||
NodeFetchTest,
|
||||
{
|
||||
testClass: OptionsTest,
|
||||
options: "--req some-string",
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import { PerfTest, PerfOptionDictionary } from "../src";
|
||||
|
||||
import fetch from "node-fetch";
|
||||
import * as http from "http";
|
||||
|
||||
interface NodeFetchOptions {
|
||||
url: string;
|
||||
}
|
||||
|
||||
export class NodeFetchTest extends PerfTest<NodeFetchOptions> {
|
||||
private static fetchOptions = {
|
||||
agent: new http.Agent({ keepAlive: true }),
|
||||
};
|
||||
|
||||
private url = "";
|
||||
|
||||
public options: PerfOptionDictionary<NodeFetchOptions> = {
|
||||
url: {
|
||||
required: true,
|
||||
description: "Required option",
|
||||
shortName: "u",
|
||||
longName: "url",
|
||||
defaultValue: "http://www.example.org",
|
||||
value: "http://www.example.org",
|
||||
},
|
||||
};
|
||||
|
||||
public setup(): void {
|
||||
this.url = this.parsedOptions.url.value;
|
||||
}
|
||||
|
||||
async run(): Promise<void> {
|
||||
const response = await fetch(this.url, NodeFetchTest.fetchOptions);
|
||||
await response.text();
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче