End to End Test Improvements Round 2 (#475)
This commit is contained in:
parent
acb284eac7
commit
c1141406ff
|
@ -166,7 +166,6 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
test-file:
|
test-file:
|
||||||
- ./test/cassandra/container.spec.ts
|
- ./test/cassandra/container.spec.ts
|
||||||
- ./test/mongo/container.spec.ts
|
|
||||||
- ./test/mongo/mongoIndexPolicy.spec.ts
|
- ./test/mongo/mongoIndexPolicy.spec.ts
|
||||||
- ./test/mongo/openMongoAccount.spec.ts
|
- ./test/mongo/openMongoAccount.spec.ts
|
||||||
- ./test/notebooks/uploadAndOpenNotebook.spec.ts
|
- ./test/notebooks/uploadAndOpenNotebook.spec.ts
|
||||||
|
@ -194,7 +193,6 @@ jobs:
|
||||||
path: failed-*
|
path: failed-*
|
||||||
cleanupaccounts:
|
cleanupaccounts:
|
||||||
name: "Cleanup Test Database Accounts"
|
name: "Cleanup Test Database Accounts"
|
||||||
needs: [lint, format, compile, unittest]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }}
|
NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }}
|
||||||
|
@ -226,7 +224,7 @@ jobs:
|
||||||
- run: cp ./configs/prod.json config.json
|
- run: cp ./configs/prod.json config.json
|
||||||
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "GitHub" -Password "$AZURE_DEVOPS_PAT"
|
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "GitHub" -Password "$AZURE_DEVOPS_PAT"
|
||||||
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
|
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
|
||||||
- run: nuget push -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
|
- run: nuget push -SkipDuplicate -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
name: packages
|
name: packages
|
||||||
with:
|
with:
|
||||||
|
@ -251,7 +249,7 @@ jobs:
|
||||||
- run: sed -i 's/Azure.Cosmos.DB.Data.Explorer/Azure.Cosmos.DB.Data.Explorer.MPAC/g' DataExplorer.nuspec
|
- run: sed -i 's/Azure.Cosmos.DB.Data.Explorer/Azure.Cosmos.DB.Data.Explorer.MPAC/g' DataExplorer.nuspec
|
||||||
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "GitHub" -Password "$AZURE_DEVOPS_PAT"
|
- run: nuget sources add -Name "ADO" -Source "$NUGET_SOURCE" -UserName "GitHub" -Password "$AZURE_DEVOPS_PAT"
|
||||||
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
|
- run: nuget pack -Version "2.0.0-github-${GITHUB_SHA}"
|
||||||
- run: nuget push -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
|
- run: nuget push -SkipDuplicate -Source "$NUGET_SOURCE" -ApiKey Az *.nupkg
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
name: packages
|
name: packages
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -8592,6 +8592,13 @@
|
||||||
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
|
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"ms": "2.1.2"
|
"ms": "2.1.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ms": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"decamelize": {
|
"decamelize": {
|
||||||
|
@ -16081,9 +16088,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||||
},
|
},
|
||||||
"msal": {
|
"msal": {
|
||||||
"version": "1.4.4",
|
"version": "1.4.4",
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
"knockout": "3.5.1",
|
"knockout": "3.5.1",
|
||||||
"mkdirp": "1.0.4",
|
"mkdirp": "1.0.4",
|
||||||
"monaco-editor": "0.18.1",
|
"monaco-editor": "0.18.1",
|
||||||
|
"ms": "2.1.3",
|
||||||
"msal": "1.4.4",
|
"msal": "1.4.4",
|
||||||
"object.entries": "1.1.0",
|
"object.entries": "1.1.0",
|
||||||
"office-ui-fabric-react": "7.134.1",
|
"office-ui-fabric-react": "7.134.1",
|
||||||
|
|
|
@ -20,21 +20,12 @@ describe("MongoDB Index policy tests", () => {
|
||||||
await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true });
|
await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true });
|
||||||
await frame.waitFor(LOADING_STATE_DELAY);
|
await frame.waitFor(LOADING_STATE_DELAY);
|
||||||
await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true });
|
await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true });
|
||||||
let databases = await frame.$$(`div[class="databaseHeader main1 nodeItem "] > div[class="treeNodeHeader "]`);
|
const dbId = await createDatabase(frame);
|
||||||
if (databases.length === 0) {
|
|
||||||
await createDatabase(frame);
|
|
||||||
await frame.waitFor(25000);
|
await frame.waitFor(25000);
|
||||||
databases = await frame.$$(`div[class="databaseHeader main1 nodeItem "] > div[class="treeNodeHeader "]`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectedDbId = (await frame.evaluate((element) => element.innerText, databases[0]))
|
|
||||||
.replace(/[\u{0080}-\u{FFFF}]/gu, "")
|
|
||||||
.trim();
|
|
||||||
|
|
||||||
// click on database
|
// click on database
|
||||||
await frame.waitForSelector(`div[data-test="${selectedDbId}"]`);
|
await frame.waitForSelector(`div[data-test="${dbId}"]`);
|
||||||
await frame.waitFor(LOADING_STATE_DELAY);
|
await frame.waitFor(LOADING_STATE_DELAY);
|
||||||
await frame.click(`div[data-test="${selectedDbId}"]`);
|
await frame.click(`div[data-test="${dbId}"]`);
|
||||||
await frame.waitFor(LOADING_STATE_DELAY);
|
await frame.waitFor(LOADING_STATE_DELAY);
|
||||||
|
|
||||||
// click on scale & setting
|
// click on scale & setting
|
||||||
|
@ -114,7 +105,7 @@ describe("MongoDB Index policy tests", () => {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const testName = (expect as any).getState().currentTestName;
|
const testName = (expect as any).getState().currentTestName;
|
||||||
await page.screenshot({ path: `Test Failed ${testName}.jpg` });
|
await page.screenshot({ path: `failed-${testName}.jpg` });
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe("Mongo", () => {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const testName = (expect as any).getState().currentTestName;
|
const testName = (expect as any).getState().currentTestName;
|
||||||
await page.screenshot({ path: `Test Failed ${testName}.jpg` });
|
await page.screenshot({ path: `failed-${testName}.jpg` });
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -67,6 +67,7 @@ export async function createDatabase(frame: Frame) {
|
||||||
// click submit
|
// click submit
|
||||||
await frame.waitFor("#submitBtnAddCollection");
|
await frame.waitFor("#submitBtnAddCollection");
|
||||||
await frame.click("#submitBtnAddCollection");
|
await frame.click("#submitBtnAddCollection");
|
||||||
|
return dbId;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function onClickSaveButton(frame: Frame) {
|
export async function onClickSaveButton(frame: Frame) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
|
const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
|
||||||
const { CosmosDBManagementClient } = require("@azure/arm-cosmosdb");
|
const { CosmosDBManagementClient } = require("@azure/arm-cosmosdb");
|
||||||
|
const ms = require("ms");
|
||||||
|
const { time } = require("console");
|
||||||
|
|
||||||
const clientId = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_ID"];
|
const clientId = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_ID"];
|
||||||
const secret = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET"];
|
const secret = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET"];
|
||||||
|
@ -7,7 +9,7 @@ const tenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
|
||||||
const subscriptionId = "69e02f2d-f059-4409-9eac-97e8a276ae2c";
|
const subscriptionId = "69e02f2d-f059-4409-9eac-97e8a276ae2c";
|
||||||
const resourceGroupName = "runners";
|
const resourceGroupName = "runners";
|
||||||
|
|
||||||
const twentyMinutesAgo = new Date(Date.now() - 1000 * 60 * 20);
|
const twentyMinutesAgo = new Date(Date.now() - 1000 * 60 * 20).getTime();
|
||||||
|
|
||||||
// Deletes all SQL and Mongo databases created more than 20 minutes ago in the test runner accounts
|
// Deletes all SQL and Mongo databases created more than 20 minutes ago in the test runner accounts
|
||||||
async function main() {
|
async function main() {
|
||||||
|
@ -19,22 +21,22 @@ async function main() {
|
||||||
const mongoDatabases = await client.mongoDBResources.listMongoDBDatabases(resourceGroupName, account.name);
|
const mongoDatabases = await client.mongoDBResources.listMongoDBDatabases(resourceGroupName, account.name);
|
||||||
for (const database of mongoDatabases) {
|
for (const database of mongoDatabases) {
|
||||||
const timestamp = database.name.split("-")[1];
|
const timestamp = database.name.split("-")[1];
|
||||||
if (!timestamp || new Date(timestamp) < twentyMinutesAgo) {
|
if (!timestamp || Number(timestamp) < twentyMinutesAgo) {
|
||||||
await client.mongoDBResources.deleteMongoDBDatabase(resourceGroupName, account.name, database.name);
|
await client.mongoDBResources.deleteMongoDBDatabase(resourceGroupName, account.name, database.name);
|
||||||
console.log(`DELETED: ${account.name} | ${database.name} | Timestamp: ${Date.now()}`);
|
console.log(`DELETED: ${account.name} | ${database.name} | Age: ${ms(Date.now() - Number(timestamp))}`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`SKIPPED: ${account.name} | ${database.name} | Timestamp: ${Date.now()}`);
|
console.log(`SKIPPED: ${account.name} | ${database.name} | Age: ${ms(Date.now() - Number(timestamp))}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (account.kind === "GlobalDocumentDB") {
|
} else if (account.kind === "GlobalDocumentDB") {
|
||||||
const sqlDatabases = await client.sqlResources.listSqlDatabases(resourceGroupName, account.name);
|
const sqlDatabases = await client.sqlResources.listSqlDatabases(resourceGroupName, account.name);
|
||||||
for (const database of sqlDatabases) {
|
for (const database of sqlDatabases) {
|
||||||
const timestamp = database.name.split("-")[1];
|
const timestamp = database.name.split("-")[1];
|
||||||
if (!timestamp || new Date(timestamp) < twentyMinutesAgo) {
|
if (!timestamp || Number(timestamp) < twentyMinutesAgo) {
|
||||||
await client.sqlResources.deleteSqlDatabase(resourceGroupName, account.name, database.name);
|
await client.sqlResources.deleteSqlDatabase(resourceGroupName, account.name, database.name);
|
||||||
console.log(`DELETED: ${account.name} | ${database.name} | Timestamp: ${Date.now()}`);
|
console.log(`DELETED: ${account.name} | ${database.name} | Age: ${ms(Date.now() - Number(timestamp))}`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`SKIPPED: ${account.name} | ${database.name} | Timestamp: ${Date.now()}`);
|
console.log(`SKIPPED: ${account.name} | ${database.name} | Age: ${ms(Date.now() - Number(timestamp))}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue