Skip to content

Commit

Permalink
Skip Azure tests (#2335)
Browse files Browse the repository at this point in the history
* Skip the Azure long running tests

* Guess you cant skip the suiteTeardown

* Need to comment out dispose since treeItem wont exist

* Remove unused code
  • Loading branch information
nturinski authored Nov 16, 2022
1 parent afc5037 commit c26e95c
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions test/nightly/global.resource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
*--------------------------------------------------------------------------------------------*/

import { WebSiteManagementClient } from '@azure/arm-appservice';
import { ResourceManagementClient } from "@azure/arm-resources";
import { createTestActionContext, TestAzureAccount } from '@microsoft/vscode-azext-dev';
import * as vscode from 'vscode';
import { AzureAccountTreeItem, createResourceClient, createWebSiteClient, ext, ISubscriptionContext } from '../../extension.bundle';
import { AzureAccountTreeItem, createWebSiteClient, ext, ISubscriptionContext } from '../../extension.bundle';
import { longRunningTestsEnabled } from '../global.test';

export let testAccount: TestAzureAccount;
export let webSiteClient: WebSiteManagementClient;
export const resourceGroupsToDelete: string[] = [];

suiteSetup(async function (this: Mocha.Context): Promise<void> {
this.skip();
if (longRunningTestsEnabled) {
this.timeout(2 * 60 * 1000);
testAccount = new TestAzureAccount(vscode);
Expand All @@ -27,21 +27,9 @@ suiteSetup(async function (this: Mocha.Context): Promise<void> {
suiteTeardown(async function (this: Mocha.Context): Promise<void> {
if (longRunningTestsEnabled) {
this.timeout(10 * 60 * 1000);
await Promise.all(resourceGroupsToDelete.map(async resource => {
await beginDeleteResourceGroup(resource);
}));
ext.azureAccountTreeItem.dispose();
// await Promise.all(resourceGroupsToDelete.map(async resource => {
// await beginDeleteResourceGroup(resource);
// }));
// ext.azureAccountTreeItem.dispose();
}
});

export async function beginDeleteResourceGroup(resourceGroup: string): Promise<void> {
const client: ResourceManagementClient = await createResourceClient([await createTestActionContext(), <ISubscriptionContext>testAccount.getSubscriptionContext()]);
if ((await client.resourceGroups.checkExistence(resourceGroup)).body) {
console.log(`Started delete of resource group "${resourceGroup}"...`);
await client.resourceGroups.beginDeleteAndWait(resourceGroup);
console.log(`Successfully started delete of resource group "${resourceGroup}".`);
} else {
// If the test failed, the resource group might not actually exist
console.log(`Ignoring resource group "${resourceGroup}" because it does not exist.`);
}
}

0 comments on commit c26e95c

Please sign in to comment.