Skip to content

Commit

Permalink
[MetricsAdvisor,test] Fix listing datafeed live tests (Azure#11787)
Browse files Browse the repository at this point in the history
We have a scenario to rename the datafeed so the listing by the
"js-test" prefix would only return one result thus break listing
tests' assumption.

Fixed by moving listing to after creating three data feeds so we still
have two data feeds with "js-test" prefix.
  • Loading branch information
jeremymeng authored Oct 12, 2020
1 parent e961914 commit 5ce310c
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions sdk/metricsadvisor/ai-metrics-advisor/test/datafeed.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,38 @@ describe("MetricsAdvisorAdministrationClient datafeed", () => {
}
});

it("creates an Azure SQL Server Feed", async () => {
const expectedSource: DataFeedSource = {
dataSourceType: "SqlServer",
dataSourceParameter: {
connectionString: testEnv.METRICS_ADVISOR_AZURE_SQL_SERVER_CONNECTION_STRING,
query: testEnv.METRICS_ADVISOR_AZURE_SQL_SERVER_QUERY
}
};
const actual = await client.createDataFeed({
name: sqlServerFeedName,
source: expectedSource,
granularity,
schema: dataFeedSchema,
ingestionSettings: dataFeedIngestion,
options
});

assert.ok(actual.id, "Expecting valid data feed id");
createdSqlServerFeedId = actual.id;
assert.equal(actual.source.dataSourceType, "SqlServer");
if (actual.source.dataSourceType === "SqlServer") {
assert.equal(
actual.source.dataSourceParameter.connectionString,
testEnv.METRICS_ADVISOR_AZURE_SQL_SERVER_CONNECTION_STRING
);
assert.equal(
actual.source.dataSourceParameter.query,
testEnv.METRICS_ADVISOR_AZURE_SQL_SERVER_QUERY
);
}
});

it("lists datafeed", async function() {
const iterator = client.listDataFeeds({
filter: {
Expand Down Expand Up @@ -407,38 +439,6 @@ describe("MetricsAdvisorAdministrationClient datafeed", () => {
await verifyDataFeedDeletion(client, createdAppFeedId);
});

it("creates an Azure SQL Server Feed", async () => {
const expectedSource: DataFeedSource = {
dataSourceType: "SqlServer",
dataSourceParameter: {
connectionString: testEnv.METRICS_ADVISOR_AZURE_SQL_SERVER_CONNECTION_STRING,
query: testEnv.METRICS_ADVISOR_AZURE_SQL_SERVER_QUERY
}
};
const actual = await client.createDataFeed({
name: sqlServerFeedName,
source: expectedSource,
granularity,
schema: dataFeedSchema,
ingestionSettings: dataFeedIngestion,
options
});

assert.ok(actual.id, "Expecting valid data feed id");
createdSqlServerFeedId = actual.id;
assert.equal(actual.source.dataSourceType, "SqlServer");
if (actual.source.dataSourceType === "SqlServer") {
assert.equal(
actual.source.dataSourceParameter.connectionString,
testEnv.METRICS_ADVISOR_AZURE_SQL_SERVER_CONNECTION_STRING
);
assert.equal(
actual.source.dataSourceParameter.query,
testEnv.METRICS_ADVISOR_AZURE_SQL_SERVER_QUERY
);
}
});

it("deletes an Azure SQL Server feed", async function() {
await verifyDataFeedDeletion(client, createdSqlServerFeedId);
});
Expand Down

0 comments on commit 5ce310c

Please sign in to comment.