Skip to content
Merged
Changes from all 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 @@ -22,11 +22,15 @@ const replaceableVariables: Record<string, string> = {
NewRelic_CLIENT_ID: "azure_client_id",
NewRelic_CLIENT_SECRET: "azure_client_secret",
NewRelic_TENANT_ID: "88888888-8888-8888-8888-888888888888",
NewRelic_SUBSCRIPTION_ID: "azure_subscription_id"
NewRelic_SUBSCRIPTION_ID: "azure_subscription_id",
};

const recorderOptions: RecorderStartOptions = {
envSetupForPlayback: replaceableVariables
envSetupForPlayback: replaceableVariables,
removeCentralSanitizers: [
"AZSDK4001", // url should not be over-sanitized, fake env setup handles it already
"AZSDK3493",
],
};

export const testPollingOptions = {
Expand All @@ -36,9 +40,7 @@ export const testPollingOptions = {
describe("NewRelicObservability test", () => {
let recorder: Recorder;
let subscriptionId: string;
let clientId: string;
let tenantId: string;
let clientSecret: string;
let client: NewRelicObservability;
let location: string;
let resourceGroup: string;
Expand All @@ -47,22 +49,21 @@ describe("NewRelicObservability test", () => {
beforeEach(async function (this: Context) {
recorder = new Recorder(this.currentTest);
await recorder.start(recorderOptions);
subscriptionId = env.NewRelic_SUBSCRIPTION_ID || '';
clientId = env.NewRelic_CLIENT_ID || '';
tenantId = env.NewRelic_TENANT_ID || '';
clientSecret = env.NewRelic_CLIENT_SECRET || '';
subscriptionId = env.NewRelic_SUBSCRIPTION_ID || "";
tenantId = env.NewRelic_TENANT_ID || "";
const credentialOptions: CreateTestCredentialOptions = {
tenantId,
clientId,
clientSecret
}
};
// This is an example of how the environment variables are used
const credential = createTestCredential(undefined, credentialOptions);
client = new NewRelicObservability(credential, subscriptionId, recorder.configureClientOptions({}));
const credential = createTestCredential(credentialOptions);
client = new NewRelicObservability(
credential,
subscriptionId,
recorder.configureClientOptions({}),
);
location = "centraluseuap";
resourceGroup = "myjstest";
resourcename = "resourcetest1";

});

afterEach(async function () {
Expand All @@ -86,22 +87,23 @@ describe("NewRelicObservability test", () => {
firstName: "ZiWei",
lastName: "Chen (WICRESOFT NORTH AMERICA LTD)",
emailAddress: "[email protected]",
phoneNumber: ""
phoneNumber: "",
},
planData: {
usageType: "PAYG",
billingCycle: "MONTHLY",
planDetails: "newrelic-pay-as-you-go-free-live@[email protected]_liftr_payg"
planDetails:
"newrelic-pay-as-you-go-free-live@[email protected]_liftr_payg",
},
},
testPollingOptions);
testPollingOptions,
);
assert.equal(res.name, resourcename);
await delay(100000)
await delay(100000);
});

it("monitors get test", async function () {
const res = await client.monitors.get(resourceGroup,
resourcename);
const res = await client.monitors.get(resourceGroup, resourcename);
assert.equal(res.name, resourcename);
});

Expand All @@ -115,12 +117,14 @@ describe("NewRelicObservability test", () => {

it("monitors delete test", async function () {
const resArray = new Array();
const res = await client.monitors.beginDeleteAndWait(resourceGroup, "[email protected]", resourcename
)
const res = await client.monitors.beginDeleteAndWait(
resourceGroup,
"[email protected]",
resourcename,
);
for await (let item of client.monitors.listByResourceGroup(resourceGroup)) {
resArray.push(item);
}
assert.equal(resArray.length, 1);
});

})
});