Skip to content

Commit 91ab54d

Browse files
authored
[keyvault] Remove timeout tests (Azure#26692)
### Packages impacted by this PR - `@azure/keyvault-certificates` - `@azure/keyvault-keys` - `@azure/keyvault-secrets` ### Issues associated with this PR - Fix Azure#26601 - Fix Azure#26229 - Fix Azure#26644 - Fix Azure#26157 - Fix Azure#25853 - Fix Azure#26182 - Fix Azure#23997 - Fix Azure#24755 - Fix Azure#23580 ### Describe the problem that is addressed by this PR See [the issue](Azure#26601), but basically these tests are super flaky and don't add any value -- they're testing the transport, not Key Vault. Removing them will make the pipelines much greener (and make rerecording much much easier).
1 parent 24ba6c9 commit 91ab54d

File tree

17 files changed

+20
-620
lines changed

17 files changed

+20
-620
lines changed

sdk/keyvault/keyvault-certificates/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "js",
44
"TagPrefix": "js/keyvault/keyvault-certificates",
5-
"Tag": "js/keyvault/keyvault-certificates_43821e21b3"
5+
"Tag": "js/keyvault/keyvault-certificates_dff8f6c5fd"
66
}

sdk/keyvault/keyvault-certificates/test/public/CRUD.spec.ts

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,6 @@ describe("Certificates client - create, read, update and delete", () => {
8585
});
8686
});
8787

88-
// On playback mode, the tests happen too fast for the timeout to work
89-
it("can create a certificate with requestOptions timeout", async function (this: Context) {
90-
if (isPlaybackMode()) {
91-
this.skip();
92-
}
93-
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
94-
95-
await assertThrowsAbortError(async () => {
96-
await client.beginCreateCertificate(certificateName, basicCertificatePolicy, {
97-
...testPollerProperties,
98-
requestOptions: {
99-
timeout: 1,
100-
},
101-
});
102-
});
103-
});
104-
10588
it("cannot create a certificate with an empty name", async function () {
10689
const certificateName = "";
10790
try {
@@ -183,31 +166,6 @@ describe("Certificates client - create, read, update and delete", () => {
183166
assert.equal(result.properties.enabled, false);
184167
});
185168

186-
// On playback mode, the tests happen too fast for the timeout to work
187-
it("can update certificate with requestOptions timeout", async function (this: Context) {
188-
if (isPlaybackMode()) {
189-
this.skip();
190-
}
191-
192-
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
193-
194-
const poller = await client.beginCreateCertificate(
195-
certificateName,
196-
basicCertificatePolicy,
197-
testPollerProperties
198-
);
199-
const { version } = poller.getResult()!.properties;
200-
201-
await assertThrowsAbortError(async () => {
202-
await client.updateCertificateProperties(certificateName, version || "", {
203-
tags: {
204-
customTag: "value",
205-
},
206-
requestOptions: { timeout: 1 },
207-
});
208-
});
209-
});
210-
211169
it("can get a certificate", async function (this: Context) {
212170
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
213171
await client.beginCreateCertificate(
@@ -303,23 +261,6 @@ describe("Certificates client - create, read, update and delete", () => {
303261
assert.equal(base64CER, base64PublicCertificate);
304262
});
305263

306-
// On playback mode, the tests happen too fast for the timeout to work
307-
it("can get a certificate with requestOptions timeout", async function (this: Context) {
308-
if (isPlaybackMode()) {
309-
this.skip();
310-
}
311-
312-
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
313-
await client.beginCreateCertificate(
314-
certificateName,
315-
basicCertificatePolicy,
316-
testPollerProperties
317-
);
318-
await assertThrowsAbortError(async () => {
319-
await client.getCertificate(certificateName, { requestOptions: { timeout: 1 } });
320-
});
321-
});
322-
323264
it("can retrieve the latest version of a certificate value", async function (this: Context) {
324265
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
325266
await client.beginCreateCertificate(
@@ -379,28 +320,6 @@ describe("Certificates client - create, read, update and delete", () => {
379320
await poller.pollUntilDone();
380321
});
381322

382-
// On playback mode, the tests happen too fast for the timeout to work
383-
it("can delete a certificate with requestOptions timeout", async function (this: Context) {
384-
if (isPlaybackMode()) {
385-
this.skip();
386-
}
387-
388-
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
389-
await client.beginCreateCertificate(
390-
certificateName,
391-
basicCertificatePolicy,
392-
testPollerProperties
393-
);
394-
await assertThrowsAbortError(async () => {
395-
await client.beginDeleteCertificate(certificateName, {
396-
...testPollerProperties,
397-
requestOptions: {
398-
timeout: 1,
399-
},
400-
});
401-
});
402-
});
403-
404323
it("can delete a certificate (Non Existing)", async function (this: Context) {
405324
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
406325
let error;

sdk/keyvault/keyvault-certificates/test/public/list.spec.ts

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33

44
import { Context } from "mocha";
55
import { assert } from "@azure/test-utils";
6-
import { env, isPlaybackMode, Recorder, isRecordMode } from "@azure-tools/test-recorder";
7-
import { isNode } from "@azure/core-util";
6+
import { env, Recorder, isRecordMode } from "@azure-tools/test-recorder";
87

98
import { CertificateClient } from "../../src";
10-
import { assertThrowsAbortError } from "./utils/common";
119
import { testPollerProperties } from "./utils/recorderUtils";
1210
import { authenticate } from "./utils/testAuthentication";
1311
import { getServiceVersion } from "./utils/common";
@@ -141,16 +139,6 @@ describe("Certificates client - list certificates in various ways", () => {
141139
assert.equal(found, 2, "Unexpected number of certificates found by listCertificates.");
142140
});
143141

144-
if (isNode && !isPlaybackMode()) {
145-
// On playback mode, the tests happen too fast for the timeout to work
146-
it("can get several inserted certificates with requestOptions timeout", async function () {
147-
const iter = client.listPropertiesOfCertificates({ requestOptions: { timeout: 1 } });
148-
await assertThrowsAbortError(async () => {
149-
await iter.next();
150-
});
151-
});
152-
}
153-
154142
it("can list deleted certificates by page", async function (this: Context) {
155143
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
156144
const certificateNames = [`${certificateName}0`, `${certificateName}1`];
@@ -181,17 +169,6 @@ describe("Certificates client - list certificates in various ways", () => {
181169
}
182170
});
183171

184-
// On playback mode, the tests happen too fast for the timeout to work
185-
it("list deleted certificates with requestOptions timeout", async function () {
186-
if (isPlaybackMode()) {
187-
this.skip();
188-
}
189-
const iter = client.listDeletedCertificates({ requestOptions: { timeout: 1 } });
190-
await assertThrowsAbortError(async () => {
191-
await iter.next();
192-
});
193-
});
194-
195172
it("can retrieve all versions of a certificate", async function (this: Context) {
196173
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
197174

@@ -237,20 +214,6 @@ describe("Certificates client - list certificates in various ways", () => {
237214
assert.deepEqual(results, versions);
238215
});
239216

240-
// On playback mode, the tests happen too fast for the timeout to work
241-
it("can get the versions of a certificate with requestOptions timeout", async function () {
242-
if (isPlaybackMode()) {
243-
this.skip();
244-
}
245-
246-
const iter = client.listPropertiesOfCertificateVersions("doesn't matter", {
247-
requestOptions: { timeout: 1 },
248-
});
249-
await assertThrowsAbortError(async () => {
250-
await iter.next();
251-
});
252-
});
253-
254217
it("can list certificate versions (non existing)", async function (this: Context) {
255218
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
256219
let totalVersions = 0;

sdk/keyvault/keyvault-certificates/test/public/lro.recover.spec.ts

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
import { assert } from "@azure/test-utils";
55
import { Context } from "mocha";
6-
import { env, isPlaybackMode, Recorder } from "@azure-tools/test-recorder";
6+
import { env, Recorder } from "@azure-tools/test-recorder";
77
import { PollerStoppedError } from "@azure/core-lro";
88

99
import { CertificateClient, DeletedCertificate, DefaultCertificatePolicy } from "../../src";
10-
import { assertThrowsAbortError } from "./utils/common";
1110
import { testPollerProperties } from "./utils/recorderUtils";
1211
import { authenticate } from "./utils/testAuthentication";
1312
import { getServiceVersion } from "./utils/common";
@@ -113,29 +112,4 @@ describe("Certificates client - LRO - recoverDelete", () => {
113112

114113
await testClient.flushCertificate(certificateName);
115114
});
116-
117-
// On playback mode, the tests happen too fast for the timeout to work
118-
it("can recover a deleted certificate with requestOptions timeout", async function (this: Context) {
119-
if (isPlaybackMode()) {
120-
this.skip();
121-
}
122-
123-
const certificateName = testClient.formatName(
124-
`${certificatePrefix}-${this!.test!.title}-${certificateSuffix}`
125-
);
126-
const createPoller = await client.beginCreateCertificate(
127-
certificateName,
128-
DefaultCertificatePolicy,
129-
testPollerProperties
130-
);
131-
await createPoller.pollUntilDone();
132-
const deletePoller = await client.beginDeleteCertificate(certificateName, testPollerProperties);
133-
await deletePoller.pollUntilDone();
134-
await assertThrowsAbortError(async () => {
135-
await client.beginRecoverDeletedCertificate(certificateName, {
136-
requestOptions: { timeout: 1 },
137-
...testPollerProperties,
138-
});
139-
});
140-
});
141115
});

sdk/keyvault/keyvault-certificates/test/public/recoverBackupRestore.spec.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
import { assert } from "@azure/test-utils";
55
import { Context } from "mocha";
66
import { env, isPlaybackMode, Recorder, isRecordMode } from "@azure-tools/test-recorder";
7-
import { isNode } from "@azure/core-util";
87

98
import { CertificateClient } from "../../src";
109
import { testPollerProperties } from "./utils/recorderUtils";
11-
import { assertThrowsAbortError } from "./utils/common";
1210
import { authenticate } from "./utils/testAuthentication";
1311
import { getServiceVersion } from "./utils/common";
1412
import TestClient from "./utils/testClient";
@@ -114,15 +112,6 @@ describe("Certificates client - restore certificates and recover backups", () =>
114112
});
115113
}
116114

117-
if (isNode && !isPlaybackMode()) {
118-
// On playback mode, the tests happen too fast for the timeout to work
119-
it("can generate a backup of a certificate with requestOptions timeout", async function () {
120-
await assertThrowsAbortError(async () => {
121-
await client.backupCertificate("doesn't matter", { requestOptions: { timeout: 1 } });
122-
});
123-
});
124-
}
125-
126115
it("can restore a certificate (Malformed Backup Bytes)", async function () {
127116
const backup = new Uint8Array(4728);
128117
let error;
@@ -138,22 +127,4 @@ describe("Certificates client - restore certificates and recover backups", () =>
138127
"Unexpected error from restoreCertificate()"
139128
);
140129
});
141-
142-
if (isNode && !isPlaybackMode()) {
143-
// On playback mode, the tests happen too fast for the timeout to work
144-
it("can restore a key with requestOptions timeout", async function (this: Context) {
145-
const certificateName = testClient.formatName(`${prefix}-${this!.test!.title}-${suffix}`);
146-
const createPoller = await client.beginCreateCertificate(
147-
certificateName,
148-
basicCertificatePolicy,
149-
testPollerProperties
150-
);
151-
await createPoller.pollUntilDone();
152-
const backup = await client.backupCertificate(certificateName);
153-
154-
await assertThrowsAbortError(async () => {
155-
await client.restoreCertificateBackup(backup!, { requestOptions: { timeout: 1 } });
156-
});
157-
});
158-
}
159130
});

sdk/keyvault/keyvault-keys/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "js",
44
"TagPrefix": "js/keyvault/keyvault-keys",
5-
"Tag": "js/keyvault/keyvault-keys_ebe5390b7f"
5+
"Tag": "js/keyvault/keyvault-keys_57c90c0ceb"
66
}

sdk/keyvault/keyvault-keys/test/internal/recoverBackupRestore.spec.ts

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,9 @@ import { assert } from "@azure/test-utils";
55
import { Context } from "mocha";
66
import { isNode } from "@azure/core-util";
77
import { KeyClient } from "../../src";
8-
import { assertThrowsAbortError, getServiceVersion } from "../public/utils/common";
8+
import { getServiceVersion } from "../public/utils/common";
99
import { testPollerProperties } from "../public/utils/recorderUtils";
10-
import {
11-
Recorder,
12-
env,
13-
isPlaybackMode,
14-
isRecordMode,
15-
isLiveMode,
16-
} from "@azure-tools/test-recorder";
10+
import { Recorder, env, isPlaybackMode, isRecordMode } from "@azure-tools/test-recorder";
1711
import { authenticate, envSetupForPlayback } from "../public/utils/testAuthentication";
1812
import TestClient from "../public/utils/testClient";
1913
import { RestoreKeyBackupPoller } from "../public/utils/lro/restore/poller";
@@ -89,17 +83,6 @@ describe("Keys client - restore keys and recover backups", () => {
8983
await testClient.flushKey(keyName);
9084
});
9185

92-
// On playback mode, the tests happen too fast for the timeout to work
93-
it("can generate a backup of a key with requestOptions timeout", async function () {
94-
if (!isLiveMode()) {
95-
console.log("Timeout tests don't work on playback mode.");
96-
this.skip();
97-
}
98-
await assertThrowsAbortError(async () => {
99-
await client.backupKey("doesntmatter", { requestOptions: { timeout: 1 } });
100-
});
101-
});
102-
10386
it("fails to generate a backup of a non-existing key", async function (this: Context) {
10487
const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`);
10588
let error;
@@ -143,23 +126,6 @@ describe("Keys client - restore keys and recover backups", () => {
143126
});
144127
}
145128

146-
// On playback mode, the tests happen too fast for the timeout to work
147-
it("can restore a key with requestOptions timeout", async function (this: Context) {
148-
if (!isLiveMode()) {
149-
console.log("Timeout tests don't work on playback mode.");
150-
this.skip();
151-
}
152-
153-
const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`);
154-
await client.createKey(keyName, "RSA");
155-
const backup = await client.backupKey(keyName);
156-
await testClient.flushKey(keyName);
157-
158-
await assertThrowsAbortError(async () => {
159-
await client.restoreKeyBackup(backup!, { requestOptions: { timeout: 1 } });
160-
});
161-
});
162-
163129
it("fails to restore a key with a malformed backup", async function () {
164130
const backup = new Uint8Array(8693);
165131
let error;

0 commit comments

Comments
 (0)