Skip to content

Commit

Permalink
update env vars for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maorleger committed Jan 15, 2021
1 parent 18c027b commit 54096d6
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion sdk/keyvault/keyvault-admin/test/utils/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function authenticate(that: any): Promise<any> {
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "azure_tenant_id",
KEYVAULT_URI: "https://uri.keyvault.azure.net",
KEYVAULT_URI: "https://keyvault_name.vault.azure.net",
BLOB_CONTAINER_NAME: "uri",
BLOB_STORAGE_ACCOUNT_NAME: "blob_storage_account_name",
BLOB_STORAGE_SAS_TOKEN: "blob_storage_sas_token",
Expand Down
1 change: 1 addition & 0 deletions sdk/keyvault/keyvault-certificates/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module.exports = function(config) {
"AZURE_CLIENT_SECRET",
"AZURE_TENANT_ID",
"KEYVAULT_NAME",
"KEYVAULT_URI",
"TEST_MODE"
],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export async function authenticate(that: Context): Promise<any> {
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "azure_tenant_id",
KEYVAULT_NAME: "keyvault_name"
KEYVAULT_NAME: "keyvault_name",
KEYVAULT_URI: "https://keyvault_name.vault.azure.net"
},
customizationsOnRecordings: [
(recording: any): any =>
Expand Down
1 change: 1 addition & 0 deletions sdk/keyvault/keyvault-keys/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module.exports = function(config) {
"AZURE_CLIENT_SECRET",
"AZURE_TENANT_ID",
"KEYVAULT_NAME",
"KEYVAULT_URI",
"TEST_MODE"
],

Expand Down
30 changes: 15 additions & 15 deletions sdk/keyvault/keyvault-keys/test/public/list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
let testClient: TestClient;
let recorder: Recorder;

beforeEach(async function () {
beforeEach(async function() {
const authentication = await authenticate(this, serviceVersion);
keySuffix = authentication.keySuffix;
client = authentication.client;
testClient = authentication.testClient;
recorder = authentication.recorder;
});

afterEach(async function () {
afterEach(async function() {
await recorder.stop();
});

Expand All @@ -37,8 +37,8 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
// Use this while recording to make sure the target keyvault is clean.
// The next tests will produce a more consistent output.
// This test is only useful while developing locally.
it("can purge all keys", async function (): Promise<void> {
// WARNING: When TEST_MODE equals "record", all of the keys in the indicated KEYVAULT_NAME will be deleted as part of this test.
it("can purge all keys", async function(): Promise<void> {
// WARNING: When TEST_MODE equals "record", all of the keys in the indicated KEYVAULT_URI will be deleted as part of this test.
if (!isRecordMode()) {
return this.skip();
}
Expand All @@ -58,7 +58,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
}
});

it("can get the versions of a key", async function () {
it("can get the versions of a key", async function() {
const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`);
await client.createKey(keyName, "RSA");
let totalVersions = 0;
Expand All @@ -75,7 +75,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
});

// On playback mode, the tests happen too fast for the timeout to work
it("can get the versions of a key with requestOptions timeout", async function () {
it("can get the versions of a key with requestOptions timeout", async function() {
recorder.skip(undefined, "Timeout tests don't work on playback mode.");
const iter = client.listPropertiesOfKeyVersions("doesntmatter", {
requestOptions: { timeout: 1 }
Expand All @@ -85,7 +85,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
});
});

it("can get the versions of a key (paged)", async function () {
it("can get the versions of a key (paged)", async function() {
const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`);
await client.createKey(keyName, "RSA");
let totalVersions = 0;
Expand All @@ -103,7 +103,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
await testClient.flushKey(keyName);
});

it("list 0 versions of a non-existing key", async function () {
it("list 0 versions of a non-existing key", async function() {
const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`);
let totalVersions = 0;
for await (const version of client.listPropertiesOfKeyVersions(keyName)) {
Expand All @@ -117,7 +117,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
assert.equal(totalVersions, 0, `Unexpected total versions for key ${keyName}`);
});

it("list 0 versions of a non-existing key (paged)", async function () {
it("list 0 versions of a non-existing key (paged)", async function() {
const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`);
let totalVersions = 0;
for await (const page of client.listPropertiesOfKeyVersions(keyName).byPage()) {
Expand All @@ -133,7 +133,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
assert.equal(totalVersions, 0, `Unexpected total versions for key ${keyName}`);
});

it("can get several inserted keys", async function () {
it("can get several inserted keys", async function() {
const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`);
const keyNames = [`${keyName}-0`, `${keyName}-1`];
for (const name of keyNames) {
Expand All @@ -155,7 +155,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
});

// On playback mode, the tests happen too fast for the timeout to work
it("can get several inserted keys with requestOptions timeout", async function () {
it("can get several inserted keys with requestOptions timeout", async function() {
recorder.skip(undefined, "Timeout tests don't work on playback mode.");
const iter = client.listPropertiesOfKeys({ requestOptions: { timeout: 1 } });

Expand All @@ -164,7 +164,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
});
});

it("can get several inserted keys (paged)", async function () {
it("can get several inserted keys (paged)", async function() {
const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`);
const keyNames = [`${keyName}-0`, `${keyName}-1`];
for (const name of keyNames) {
Expand All @@ -187,7 +187,7 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
}
});

it("list deleted keys", async function () {
it("list deleted keys", async function() {
const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`);
const keyNames = [`${keyName}-0`, `${keyName}-1`];
for (const name of keyNames) {
Expand All @@ -213,15 +213,15 @@ versionsToTest(serviceApiVersions, {}, (serviceVersion, onVersions) => {
});

// On playback mode, the tests happen too fast for the timeout to work
it("list deleted keys with requestOptions timeout", async function () {
it("list deleted keys with requestOptions timeout", async function() {
recorder.skip(undefined, "Timeout tests don't work on playback mode.");
const iter = client.listDeletedKeys({ requestOptions: { timeout: 1 } });
await assertThrowsAbortError(async () => {
await iter.next();
});
});

it("list deleted keys (paged)", async function () {
it("list deleted keys (paged)", async function() {
const keyName = testClient.formatName(`${keyPrefix}-${this!.test!.title}-${keySuffix}`);
const keyNames = [`${keyName}-0`, `${keyName}-1`];
for (const name of keyNames) {
Expand Down
5 changes: 3 additions & 2 deletions sdk/keyvault/keyvault-keys/test/utils/testAuthentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export async function authenticate(that: Context, version?: string): Promise<any
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "azure_tenant_id",
KEYVAULT_NAME: "keyvault_name"
KEYVAULT_NAME: "keyvault_name",
KEYVAULT_URI: "https://keyvault_name.vault.azure.net"
},
customizationsOnRecordings: [
(recording: any): any =>
Expand All @@ -28,7 +29,7 @@ export async function authenticate(that: Context, version?: string): Promise<any
queryParametersToSkip: []
};
const recorder = record(that, recorderEnvSetup);
const credential = await new ClientSecretCredential(
const credential = new ClientSecretCredential(
env.AZURE_TENANT_ID,
env.AZURE_CLIENT_ID,
env.AZURE_CLIENT_SECRET
Expand Down
1 change: 1 addition & 0 deletions sdk/keyvault/keyvault-secrets/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ module.exports = function(config) {
"AZURE_CLIENT_SECRET",
"AZURE_TENANT_ID",
"KEYVAULT_NAME",
"KEYVAULT_URI",
"TEST_MODE"
],

Expand Down
2 changes: 1 addition & 1 deletion sdk/keyvault/keyvault-secrets/test/public/list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("Secret client - list secrets in various ways", () => {
// The next tests will produce a more consistent output.
// This test is only useful while developing locally.
it("can purge all secrets", async function(): Promise<void> {
// WARNING: When TEST_MODE equals "record", all of the secrets in the indicated KEYVAULT_NAME will be deleted as part of this test.
// WARNING: When TEST_MODE equals "record", all of the secrets in the indicated KEYVAULT_URI will be deleted as part of this test.
if (!isRecordMode()) {
return this.skip();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export async function authenticate(that: Context): Promise<any> {
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "azure_tenant_id",
KEYVAULT_NAME: "keyvault_name"
KEYVAULT_NAME: "keyvault_name",
KEYVAULT_URI: "https://keyvault_name.vault.azure.net"
},
customizationsOnRecordings: [
(recording: any): any =>
Expand Down

0 comments on commit 54096d6

Please sign in to comment.