Skip to content

Commit

Permalink
[Schema Registry] Enable min/max testing
Browse files Browse the repository at this point in the history
  • Loading branch information
deyaaeldeen committed Sep 24, 2021
1 parent 8a8891b commit a636983
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { createRecordedClient, testEnv } from "./utils/recordedClient";
import { createRecordedClient } from "./utils/recordedClient";
import { Context } from "mocha";
import { Recorder } from "@azure-tools/test-recorder";
import { Recorder, env } from "@azure-tools/test-recorder";
import { assert, use as chaiUse } from "chai";
import chaiPromises from "chai-as-promised";
chaiUse(chaiPromises);
import { ClientSecretCredential } from "@azure/identity";

import { SchemaRegistryClient, SchemaDescription, SchemaProperties } from "../src/index";
import { SchemaRegistryClient, SchemaDescription, SchemaProperties } from "../../src/index";
import { FullOperationResponse, OperationOptions } from "@azure/core-client";

const options: OperationOptions = {
Expand Down Expand Up @@ -46,7 +46,7 @@ describe("SchemaRegistryClient", function() {
({ client, recorder } = createRecordedClient(this));
schema = {
name: "azsdk_js_test",
groupName: testEnv.SCHEMA_REGISTRY_GROUP,
groupName: env.SCHEMA_REGISTRY_GROUP,
format: "avro",
definition: JSON.stringify({
type: "record",
Expand Down Expand Up @@ -136,7 +136,7 @@ describe("SchemaRegistryClient", function() {
it("schema with whitespace", async () => {
const schema2: SchemaDescription = {
name: "azsdk_js_test2",
groupName: testEnv.SCHEMA_REGISTRY_GROUP,
groupName: env.SCHEMA_REGISTRY_GROUP,
format: "avro",
definition:
"{\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Context } from "mocha";
import { env, Recorder, record, RecorderEnvironmentSetup } from "@azure-tools/test-recorder";
import { ClientSecretCredential } from "@azure/identity";

import { SchemaRegistryClient } from "../../src/index";
import { SchemaRegistryClient } from "../../../src/index";

export interface RecordedClient {
client: SchemaRegistryClient;
Expand All @@ -21,12 +21,6 @@ const replaceableVariables: { [k: string]: string } = {
SCHEMA_REGISTRY_GROUP: "group-1"
};

export const testEnv = new Proxy(replaceableVariables, {
get: (target, key: string) => {
return env[key] || target[key];
}
});

const environmentSetup: RecorderEnvironmentSetup = {
replaceableVariables,
customizationsOnRecordings: [
Expand All @@ -47,10 +41,10 @@ const environmentSetup: RecorderEnvironmentSetup = {
export function createRecordedClient(context: Context): RecordedClient {
const recorder = record(context, environmentSetup);
const credential = new ClientSecretCredential(
testEnv.AZURE_TENANT_ID,
testEnv.AZURE_CLIENT_ID,
testEnv.AZURE_CLIENT_SECRET
env.AZURE_TENANT_ID,
env.AZURE_CLIENT_ID,
env.AZURE_CLIENT_SECRET
);
const client = new SchemaRegistryClient(testEnv.SCHEMA_REGISTRY_ENDPOINT, credential);
const client = new SchemaRegistryClient(env.SCHEMA_REGISTRY_ENDPOINT, credential);
return { client, recorder };
}

0 comments on commit a636983

Please sign in to comment.