Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip Azure tests #2335

Merged
merged 4 commits into from
Nov 16, 2022
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
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.`);
}
}