Skip to content

Commit

Permalink
[Key Vault] Separating public and internal folders (and fixing the sa…
Browse files Browse the repository at this point in the history
…mple paths) (#9584)

* [Key Vault] Separating public and internal folders

* TestMinMax: true

* cleanups after merging the latest master

* broke the build by mistake while fixing conflicts

* aligning secrets to the path changes to keys and certificates

* samples path fix
  • Loading branch information
sadasant authored Jun 18, 2020
1 parent 739f6f3 commit d7dbffd
Show file tree
Hide file tree
Showing 33 changed files with 153 additions and 126 deletions.
6 changes: 3 additions & 3 deletions sdk/keyvault/keyvault-certificates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"clean": "rimraf dist-esm dist-test typings *.tgz *.log samples/typescript/dist",
"execute:js-samples": "node ../../../common/scripts/run-samples.js samples/javascript/",
"execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/samples/typescript/src/",
"execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/keyvault-certificates/samples/typescript/src/",
"execute:samples": "npm run build:samples && npm run execute:js-samples && npm run execute:ts-samples",
"extract-api": "tsc -p . && api-extractor run --local",
"format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"samples/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"integration-test:browser": "karma start --single-run",
"integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/keyvault-certificates/test/*.test.js",
"integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/keyvault-certificates/test/*.test.js",
"integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/**/*.spec.js",
"integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/**/*.spec.js",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src test --ext .ts -f html -o keyvault-certificates-lintReport.html",
Expand Down
4 changes: 2 additions & 2 deletions sdk/keyvault/keyvault-certificates/rollup.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function nodeConfig(test = false) {

if (test) {
// entry point is every test file
baseConfig.input = ["dist-esm/keyvault-certificates/test/*.test.js"];
baseConfig.input = ["dist-esm/**/*.spec.js"];
baseConfig.plugins.unshift(
multiEntry({ exports: false }),
json() // This allows us to import/require the package.json file, to get the version and test it against the user agent.
Expand Down Expand Up @@ -131,7 +131,7 @@ export function browserConfig(test = false) {
baseConfig.external = ["fs", "fs-extra", "child_process", "path", "crypto", "constants"];
if (test) {
baseConfig.external.push("os");
baseConfig.input = ["dist-esm/keyvault-certificates/test/*.test.js"];
baseConfig.input = ["dist-esm/**/*.spec.js"];
baseConfig.plugins.unshift(
multiEntry({ exports: false }),
json() // This allows us to import/require the package.json file, to get the version and test it against the user agent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { CertificateClient } from "../src";
import { createSandbox } from "sinon";
import { env, Recorder } from "@azure/test-utils-recorder";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";

import {
AuthenticationChallengeCache,
AuthenticationChallenge,
parseWWWAuthenticate
} from "../../keyvault-common/src";
import { createSandbox } from "sinon";
import { testPollerProperties } from "./utils/recorderUtils";
} from "../../../keyvault-common/src";
import { CertificateClient } from "../../src";
import { testPollerProperties } from '../utils/recorderUtils';
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

// Following the philosophy of not testing the insides if we can test the outsides...
// I present you with this "Get Out of Jail Free" card (in reference to Monopoly).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { version } from "../package.json";
import { SDK_VERSION } from "../src/core/utils/constants";
import { packageVersion } from "../src/core/keyVaultClientContext";
import { version } from "../../package.json";
import { SDK_VERSION } from "../../src/core/utils/constants";
import { packageVersion } from "../../src/core/keyVaultClientContext";

describe("Certificates client's user agent", () => {
// The tests follow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import os from "os";
import fs from "fs";
import childProcess from "child_process";
import * as assert from "assert";
import { CertificateClient } from "../src";
import { env, Recorder } from "@azure/test-utils-recorder";
import { testPollerProperties } from "./utils/recorderUtils";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
import { AbortController } from "@azure/abort-controller";
import { assertThrowsAbortError } from "./utils/utils.common";
import { SecretClient } from "@azure/keyvault-secrets";
import { ClientSecretCredential } from "@azure/identity";
import { isNode } from "@azure/core-http";

import { CertificateClient } from "../../src";
import { assertThrowsAbortError } from "../utils/utils.common";
import { testPollerProperties } from "../utils/recorderUtils";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

describe("Certificates client - create, read, update and delete", () => {
const prefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`;
let suffix: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as assert from "assert";
import chai from "chai";
import { CertificateClient } from "../src";
import * as assert from "assert";
import { env, isPlaybackMode, Recorder, isRecordMode } from "@azure/test-utils-recorder";
import { testPollerProperties } from "./utils/recorderUtils";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
import { isNode } from "@azure/core-http";
import { assertThrowsAbortError } from "./utils/utils.common";

import { CertificateClient } from "../../src";
import { assertThrowsAbortError } from "../utils/utils.common";
import { testPollerProperties } from "../utils/recorderUtils";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

const { expect } = chai;

describe("Certificates client - list certificates in various ways", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { CertificateClient, KeyVaultCertificate, DefaultCertificatePolicy } from "../src";
import { testPollerProperties } from "./utils/recorderUtils";
import { env, Recorder } from "@azure/test-utils-recorder";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
import { PollerStoppedError } from "@azure/core-lro";
import { env, Recorder } from "@azure/test-utils-recorder";

import { CertificateClient, KeyVaultCertificate, DefaultCertificatePolicy } from "../../src";
import { testPollerProperties } from "../utils/recorderUtils";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

describe("Certificates client - LRO - create", () => {
const certificatePrefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { CertificateClient, DeletedCertificate, DefaultCertificatePolicy } from "../src";
import { testPollerProperties } from "./utils/recorderUtils";
import { env, Recorder } from "@azure/test-utils-recorder";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
import { PollerStoppedError } from "@azure/core-lro";
import { env, Recorder } from "@azure/test-utils-recorder";

import { CertificateClient, DeletedCertificate, DefaultCertificatePolicy } from "../../src";
import { testPollerProperties } from "../utils/recorderUtils";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

describe("Certificates client - lro - delete", () => {
const certificatePrefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { env, Recorder } from "@azure/test-utils-recorder";

import {
CertificateClient,
CertificateOperation,
DefaultCertificatePolicy,
KeyVaultCertificateWithPolicy
} from "../src";
import { testPollerProperties } from "./utils/recorderUtils";
import { env, Recorder } from "@azure/test-utils-recorder";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
} from "../../src";
import { testPollerProperties } from "../utils/recorderUtils";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

describe("Certificates client - LRO - certificate operation", () => {
const certificatePrefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { CertificateClient, DeletedCertificate, DefaultCertificatePolicy } from "../src";
import { testPollerProperties } from "./utils/recorderUtils";
import { env, Recorder } from "@azure/test-utils-recorder";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
import { PollerStoppedError } from "@azure/core-lro";
import { assertThrowsAbortError } from "./utils/utils.common";

import { CertificateClient, DeletedCertificate, DefaultCertificatePolicy } from "../../src";
import { assertThrowsAbortError } from "../utils/utils.common";
import { testPollerProperties } from "../utils/recorderUtils";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

describe("Certificates client - LRO - recoverDelete", () => {
const certificatePrefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@

import fs from "fs";
import childProcess from "child_process";
import { CertificateClient } from "../src";
import { testPollerProperties } from "./utils/recorderUtils";
import { isNode } from "@azure/core-http";
import { env, Recorder } from "@azure/test-utils-recorder";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
import { SecretClient } from "@azure/keyvault-secrets";
import { ClientSecretCredential } from "@azure/identity";
import { base64ToUint8Array, stringToUint8Array } from "../src/utils";
import { isNode } from "@azure/core-http";

import { CertificateClient } from "../../src";
import { base64ToUint8Array, stringToUint8Array } from "../../src/utils";
import { testPollerProperties } from "../utils/recorderUtils";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

describe("Certificates client - merge and import certificates", () => {
const prefix = `merge${env.CERTIFICATE_NAME || "CertificateName"}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { CertificateClient } from "../src";
import { env, isPlaybackMode, Recorder, delay, isRecordMode } from "@azure/test-utils-recorder";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
import { testPollerProperties } from "./utils/recorderUtils";
import { assertThrowsAbortError } from "./utils/utils.common";
import { isNode } from "@azure/core-http";

import { CertificateClient } from "../../src";
import { testPollerProperties } from "../utils/recorderUtils";
import { assertThrowsAbortError } from "../utils/utils.common";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

describe("Certificates client - restore certificates and recover backups", () => {
const prefix = `recover${env.CERTIFICATE_NAME || "CertificateName"}`;
let suffix: string;
Expand Down
1 change: 1 addition & 0 deletions sdk/keyvault/keyvault-certificates/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extends:
parameters:
PackageName: "@azure/keyvault-certificates"
ResourceServiceDirectory: keyvault
TestMinMax: true
EnvVars:
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
Expand Down
6 changes: 3 additions & 3 deletions sdk/keyvault/keyvault-keys/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
"check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"clean": "rimraf dist dist-esm dist-test types *.tgz *.log dist-browser statistics.html coverage && rimraf src/**/*.js && rimraf test/**/*.js",
"execute:js-samples": "node ../../../common/scripts/run-samples.js samples/javascript/",
"execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/samples/typescript/src/",
"execute:ts-samples": "node ../../../common/scripts/run-samples.js samples/typescript/dist/keyvault-keys/samples/typescript/src/",
"execute:samples": "npm run build:samples && npm run execute:js-samples && npm run execute:ts-samples",
"extract-api": "tsc -p . && api-extractor run --local",
"format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
"integration-test:browser": "karma start --single-run",
"integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/keyvault-keys/test/*.test.js",
"integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/keyvault-keys/test/*.test.js",
"integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace dist-esm/**/*.spec.js",
"integration-test:node:no-timeout": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace dist-esm/**/*.spec.js",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
"lint": "eslint package.json api-extractor.json src test --ext .ts -f html -o keyvault-keys-lintReport.html",
Expand Down
4 changes: 2 additions & 2 deletions sdk/keyvault/keyvault-keys/rollup.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function nodeConfig(test = false) {

if (test) {
// entry point is every test file
baseConfig.input = ["dist-esm/keyvault-keys/test/*.test.js"];
baseConfig.input = ["dist-esm/**/*.spec.js"];
baseConfig.plugins.unshift(
multiEntry({ exports: false }),
json() // This allows us to import/require the package.json file, to get the version and test it against the user agent.
Expand Down Expand Up @@ -128,7 +128,7 @@ export function browserConfig(test = false) {

baseConfig.external = ["fs-extra", "path", "crypto", "constants"];
if (test) {
baseConfig.input = ["dist-esm/keyvault-keys/test/*.test.js"];
baseConfig.input = ["dist-esm/**/*.spec.js"];
baseConfig.plugins.unshift(
multiEntry({ exports: false }),
json() // This allows us to import/require the package.json file, to get the version and test it against the user agent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { KeyClient } from "../src";
import { createSandbox } from "sinon";
import { env, Recorder } from "@azure/test-utils-recorder";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";

import {
AuthenticationChallengeCache,
AuthenticationChallenge,
parseWWWAuthenticate
} from "../../keyvault-common/src";
import { createSandbox } from "sinon";
} from "../../../keyvault-common/src";
import { KeyClient } from "../../src";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

// Following the philosophy of not testing the insides if we can test the outsides...
// I present you with this "Get Out of Jail Free" card (in reference to Monopoly).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { version } from "../package.json";
import { SDK_VERSION } from "../src/core/utils/constants";
import { packageVersion } from "../src/core/keyVaultClientContext";
import { version } from "../../package.json";
import { SDK_VERSION } from "../../src/core/utils/constants";
import { packageVersion } from "../../src/core/keyVaultClientContext";

describe("Keys client's user agent", () => {
// The tests follow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { KeyClient, CreateEcKeyOptions, UpdateKeyPropertiesOptions, GetKeyOptions } from "../src";
import { RestError } from "@azure/core-http";
import { testPollerProperties } from "./utils/recorderUtils";
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 { assertThrowsAbortError } from "./utils/utils.common";
import { env, Recorder } from "@azure/test-utils-recorder";

import { KeyClient, CreateEcKeyOptions, UpdateKeyPropertiesOptions, GetKeyOptions } from "../../src";
import { assertThrowsAbortError } from "../utils/utils.common";
import { testPollerProperties } from "../utils/recorderUtils";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

describe("Keys client - create, read, update and delete operations", () => {
const keyPrefix = `recover${env.KEY_NAME || "KeyName"}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
import * as assert from "assert";
import { createHash, publicEncrypt } from "crypto";
import * as constants from "constants";
import { ClientSecretCredential } from "@azure/identity";
import { CryptographyClient, KeyVaultKey, KeyClient } from "../src";
import { convertJWKtoPEM } from "../src/cryptographyClient";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
import { stringToUint8Array, uint8ArrayToString } from "./utils/crypto";
import { isRecordMode, Recorder } from "@azure/test-utils-recorder";
import { ClientSecretCredential } from "@azure/identity";
import { isNode } from "@azure/core-http";

import { CryptographyClient, KeyVaultKey, KeyClient } from "../../src";
import { convertJWKtoPEM } from "../../src/cryptographyClient";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";
import { stringToUint8Array, uint8ArrayToString } from "../utils/crypto";

describe("CryptographyClient (all decrypts happen remotely)", () => {
let client: KeyClient;
let testClient: TestClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { KeyClient, JsonWebKey } from "../src";
import { env, Recorder } from "@azure/test-utils-recorder";
import { authenticate } from "./utils/testAuthentication";
import TestClient from "./utils/testClient";
import { isNode } from "@azure/core-http";

import { KeyClient, JsonWebKey } from "../../src";
import { authenticate } from "../utils/testAuthentication";
import TestClient from "../utils/testClient";

describe("Keys client - import keys", () => {
const prefix = `merge${env.CERTIFICATE_NAME || "KeyName"}`;
let suffix: string;
Expand Down
Loading

0 comments on commit d7dbffd

Please sign in to comment.