From e57e630389cdf20e1dea389ac5faddb3c35c7a6b Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 28 Apr 2023 13:47:51 +0800 Subject: [PATCH 1/2] migrate quota --- sdk/quota/arm-quota/assets.json | 6 ++++++ .../recordings/node/my_test/recording_sample_test.json | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 sdk/quota/arm-quota/assets.json delete mode 100644 sdk/quota/arm-quota/recordings/node/my_test/recording_sample_test.json diff --git a/sdk/quota/arm-quota/assets.json b/sdk/quota/arm-quota/assets.json new file mode 100644 index 000000000000..c3f507969bcf --- /dev/null +++ b/sdk/quota/arm-quota/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "js", + "TagPrefix": "js/quota/arm-quota", + "Tag": "" +} diff --git a/sdk/quota/arm-quota/recordings/node/my_test/recording_sample_test.json b/sdk/quota/arm-quota/recordings/node/my_test/recording_sample_test.json deleted file mode 100644 index f721723386d8..000000000000 --- a/sdk/quota/arm-quota/recordings/node/my_test/recording_sample_test.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} From 272a91e766424e5f0d2fb05260ecd8c8c6ba7731 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Fri, 28 Apr 2023 17:32:43 +0800 Subject: [PATCH 2/2] update files --- sdk/quota/arm-quota/assets.json | 2 +- .../test/quota_operations_test.spec.ts | 71 +++++++++++++++++++ sdk/quota/arm-quota/test/sampleTest.ts | 43 ----------- 3 files changed, 72 insertions(+), 44 deletions(-) create mode 100644 sdk/quota/arm-quota/test/quota_operations_test.spec.ts delete mode 100644 sdk/quota/arm-quota/test/sampleTest.ts diff --git a/sdk/quota/arm-quota/assets.json b/sdk/quota/arm-quota/assets.json index c3f507969bcf..a31eaf93d812 100644 --- a/sdk/quota/arm-quota/assets.json +++ b/sdk/quota/arm-quota/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/quota/arm-quota", - "Tag": "" + "Tag": "js/quota/arm-quota_d8113b784e" } diff --git a/sdk/quota/arm-quota/test/quota_operations_test.spec.ts b/sdk/quota/arm-quota/test/quota_operations_test.spec.ts new file mode 100644 index 000000000000..fd20f78fd678 --- /dev/null +++ b/sdk/quota/arm-quota/test/quota_operations_test.spec.ts @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + Recorder, + RecorderStartOptions, + delay, + isPlaybackMode, +} from "@azure-tools/test-recorder"; +import { createTestCredential } from "@azure-tools/test-credential"; +import { assert } from "chai"; +import { Context } from "mocha"; +import { AzureQuotaExtensionAPI } from "../src/azureQuotaExtensionAPI"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +describe("quota test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: AzureQuotaExtensionAPI; + let location: string; + let resourceGroup: string; + let resourcename: string; + let scope: string; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + subscriptionId = env.SUBSCRIPTION_ID || ''; + // This is an example of how the environment variables are used + const credential = createTestCredential(); + client = new AzureQuotaExtensionAPI(credential, recorder.configureClientOptions({})); + location = "eastus"; + resourceGroup = "myjstest"; + resourcename = "StandardSkuPublicIpAddresses"; + scope = + "subscriptions/" + subscriptionId + "/providers/Microsoft.Network/locations/eastus" + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("quota list test", async function () { + const resArray = new Array(); + for await (let item of client.quota.list(scope)) { + resArray.push(item); + } + assert.notEqual(resArray.length, 0); + }); + +}) diff --git a/sdk/quota/arm-quota/test/sampleTest.ts b/sdk/quota/arm-quota/test/sampleTest.ts deleted file mode 100644 index 25aeb3ebcc36..000000000000 --- a/sdk/quota/arm-quota/test/sampleTest.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - Recorder, - RecorderStartOptions, - env -} from "@azure-tools/test-recorder"; -import { assert } from "chai"; -import { Context } from "mocha"; - -const replaceableVariables: Record = { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id" -}; - -const recorderOptions: RecorderStartOptions = { - envSetupForPlayback: replaceableVariables -}; - -describe("My test", () => { - let recorder: Recorder; - - beforeEach(async function(this: Context) { - recorder = new Recorder(this.currentTest); - await recorder.start(recorderOptions); - }); - - afterEach(async function() { - await recorder.stop(); - }); - - it("sample test", async function() { - console.log("Hi, I'm a test!"); - }); -});