Skip to content

Commit

Permalink
testing skip
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshaNalluru committed Aug 26, 2019
1 parent 39720e5 commit b9ea2f3
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions sdk/keyvault/keyvault-secrets/tests/CRUD.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@
import * as assert from "assert";
import { SecretsClient } from "../src";
import { retry } from "./utils/recorder";
import { env } from "@azure/test-utils-recorder";
import { env, Recorder } from "@azure/test-utils-recorder";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
import { AbortController } from "@azure/abort-controller";
import { isNode } from "@azure/core-http";

describe("Secret client - create, read, update and delete operations", () => {
const secretValue = "SECRET_VALUE";
const secretPrefix = `CRUD${env.SECRET_NAME || "SecretName"}`;
let secretSuffix: string;
let client: SecretsClient;
let testClient: TestClient;
let recorder: any;
let recorder: Recorder;

beforeEach(async function() {
const authentication = await authenticate(this);
Expand All @@ -42,28 +41,27 @@ describe("Secret client - create, read, update and delete operations", () => {
await testClient.flushSecret(secretName);
});

if (!isNode && (env.TEST_MODE === "record" || env.TEST_MODE === "playback")) {
} else {
it("can abort adding a secret", async function() {
const secretName = testClient.formatName(
`${secretPrefix}-${this!.test!.title}-${secretSuffix}`
);
const controller = new AbortController();
const resultPromise = client.setSecret(secretName, secretValue, {
requestOptions: {
abortSignal: controller.signal
}
});
controller.abort();
let error;
try {
await resultPromise;
} catch (e) {
error = e;
it("can abort adding a secret", async function() {
// recorder.skip("browser");
recorder.skip();
const secretName = testClient.formatName(
`${secretPrefix}-${this!.test!.title}-${secretSuffix}`
);
const controller = new AbortController();
const resultPromise = client.setSecret(secretName, secretValue, {
requestOptions: {
abortSignal: controller.signal
}
assert.equal(error.message, "The request was aborted");
});
}
controller.abort();
let error;
try {
await resultPromise;
} catch (e) {
error = e;
}
assert.equal(error.message, "The request was aborted");
});

it("cannot create a secret with an empty name", async function() {
const secretName = "";
Expand Down

0 comments on commit b9ea2f3

Please sign in to comment.