Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[App Config] Separate app config tests into public and internal to enable min-max tests #12694

Merged
merged 19 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
transformKeyValue,
transformKeyValueResponseWithStatusCode,
transformKeyValueResponse
} from "../src/internal/helpers";
} from "../../src/internal/helpers";
import * as assert from "assert";
import { ConfigurationSetting, HttpResponseField, HttpResponseFields } from "../src";
import { ConfigurationSetting, HttpResponseField, HttpResponseFields } from "../../src";
import { HttpHeaders } from "@azure/core-http";

describe("helper methods", () => {
Expand Down
15 changes: 11 additions & 4 deletions sdk/appconfiguration/app-configuration/test/internal/http.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ import { parseSyncToken, SyncTokens } from "../../src/internal/synctokenpolicy";
import * as assert from "assert";
import { AppConfigurationClient } from "../../src";
import nock from "nock";
import { getUserAgentPrefix, packageVersion } from "../../src/appConfigurationClient";
import {
getUserAgentPrefix,
InternalAppConfigurationClientOptions,
packageVersion
} from "../../src/appConfigurationClient";
import {
createAppConfigurationClientForTests,
assertThrowsRestError,
startRecorder
} from "../testHelpers";
} from "../utils/testHelpers";
//import InternalAppConfigurationClientOptions
KarishmaGhiya marked this conversation as resolved.
Show resolved Hide resolved
import * as chai from "chai";
import { Recorder } from "@azure/test-utils-recorder";

Expand Down Expand Up @@ -103,7 +108,9 @@ describe("http request related tests", function() {

beforeEach(function() {
recorder = startRecorder(this);
client = createAppConfigurationClientForTests() || this.skip();
client =
createAppConfigurationClientForTests<InternalAppConfigurationClientOptions>({}) ||
this.skip();
KarishmaGhiya marked this conversation as resolved.
Show resolved Hide resolved
});

afterEach(async function() {
Expand Down Expand Up @@ -146,7 +153,7 @@ describe("http request related tests", function() {
syncTokens = new SyncTokens();

client =
createAppConfigurationClientForTests({
createAppConfigurationClientForTests<InternalAppConfigurationClientOptions>({
syncTokens: syncTokens
}) || this.skip();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { join } from "path";
import * as assert from "assert";
import { isNode } from "@azure/core-http";

import { packageVersion } from "../src/appConfigurationClient";
import { packageVersion } from "../../src/appConfigurationClient";

describe("packagejson related tests", () => {
// if this test is failing you need to update the contant `packageVersion` referenced above
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { Spanner } from "../src/internal/tracingHelpers";
import { Spanner } from "../../src/internal/tracingHelpers";
import { RestError } from "@azure/core-http";
import { getTracer } from "@azure/core-tracing";
import { SpanKind, CanonicalCode } from "@opentelemetry/api";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
RestError
KarishmaGhiya marked this conversation as resolved.
Show resolved Hide resolved
} from "@azure/core-http";
import { ThrottlingRetryPolicy, getDelayInMs } from "../../src/policies/throttlingRetryPolicy";
import { assertThrowsRestError } from "../testHelpers";
import { assertThrowsRestError } from "../utils/testHelpers";

describe("ThrottlingRetryPolicy", () => {
class PassThroughPolicy {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { AppConfigurationClient } from "../src";
import { startRecorder, getTokenAuthenticationCredential, CredsAndEndpoint } from "./testHelpers";
import { AppConfigurationClient } from "../../src";
import {
startRecorder,
getTokenAuthenticationCredential,
CredsAndEndpoint
} from "../utils/testHelpers";
import * as assert from "assert";
import { Recorder, isPlaybackMode } from "@azure/test-utils-recorder";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { AppConfigurationClient } from "../src";
import { AppConfigurationClient } from "../../src";
import {
startRecorder,
createAppConfigurationClientForTests,
deleteKeyCompletely,
assertThrowsRestError
} from "./testHelpers";
} from "../utils/testHelpers";
import * as assert from "assert";
import { Recorder } from "@azure/test-utils-recorder";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
deleteKeyCompletely,
assertThrowsAbortError,
startRecorder
} from "./testHelpers";
import { AppConfigurationClient } from "../src";
} from "../utils/testHelpers";
import { AppConfigurationClient } from "../../src";
import * as assert from "assert";
import { Recorder } from "@azure/test-utils-recorder";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
assertThrowsRestError,
assertThrowsAbortError,
startRecorder
} from "./testHelpers";
import { AppConfigurationClient, ConfigurationSetting } from "../src";
} from "../utils/testHelpers";
import { AppConfigurationClient, ConfigurationSetting } from "../../src";
import { delay } from "@azure/core-http";
import { Recorder } from "@azure/test-utils-recorder";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { AppConfigurationClient, ConfigurationSetting } from "../src";
import { AppConfigurationClient, ConfigurationSetting } from "../../src";
import {
createAppConfigurationClientForTests,
deleteKeyCompletely,
assertThrowsRestError,
startRecorder
} from "./testHelpers";
} from "../utils/testHelpers";
import * as assert from "assert";
import { Recorder } from "@azure/test-utils-recorder";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { AppConfigurationClient } from "../src";
import { AppConfigurationClient, AppConfigurationClientOptions } from "../../src";
import { PagedAsyncIterableIterator } from "@azure/core-paging";
import { ConfigurationSetting, ListConfigurationSettingPage, ListRevisionsPage } from "../src";
import { ConfigurationSetting, ListConfigurationSettingPage, ListRevisionsPage } from "../../src";
import { env, isPlaybackMode, RecorderEnvironmentSetup, record } from "@azure/test-utils-recorder";
import * as assert from "assert";

Expand All @@ -12,7 +12,6 @@ import * as assert from "assert";
import * as dotenv from "dotenv";
import { RestError } from "@azure/core-http";
import { DefaultAzureCredential, TokenCredential } from "@azure/identity";
import { InternalAppConfigurationClientOptions } from "../src/appConfigurationClient";
dotenv.config();

let connectionStringNotPresentWarning = false;
Expand Down Expand Up @@ -70,8 +69,8 @@ export function getTokenAuthenticationCredential(): CredsAndEndpoint | undefined
};
}

export function createAppConfigurationClientForTests(
options?: InternalAppConfigurationClientOptions
export function createAppConfigurationClientForTests<Options extends AppConfigurationClientOptions>(
KarishmaGhiya marked this conversation as resolved.
Show resolved Hide resolved
options?: Options
): AppConfigurationClient | undefined {
const connectionString = env["APPCONFIG_CONNECTION_STRING"];

Expand Down
1 change: 1 addition & 0 deletions sdk/appconfiguration/app-configuration/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extends:
ResourceServiceDirectory: appconfiguration
TestBrowser: true
TestSamples: false
TestMinMax: true
EnvVars:
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
Expand Down