33 * Licensed under the MIT License. See LICENSE.md in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import { type ManagedEnvironment } from "@azure/arm-appcontainers" ;
7- import { type Registry } from "@azure/arm-containerregistry" ;
8- import { runWithTestActionContext } from "@microsoft/vscode-azext-dev" ;
9- import { nonNullProp , randomUtils } from "@microsoft/vscode-azext-utils" ;
10- import * as assert from "assert" ;
11- import { createAcr , createManagedEnvironment } from "../../../extension.bundle" ;
6+ import { nonNullProp } from "@microsoft/vscode-azext-utils" ;
127import { longRunningTestsEnabled } from '../../global.test' ;
13- import { resourceGroupsToDelete } from "../global.nightly.test" ;
14- import { buildParallelTestScenarios , type DwpParallelTestScenario } from './buildParallelScenarios' ;
8+ import { generateParallelTests , type DwpParallelTestScenario } from "./parallelTests" ;
159
16- let setupTask : Promise < void > ;
17- const testScenarios : DwpParallelTestScenario [ ] = buildParallelTestScenarios ( ) ;
10+ const testScenarios : DwpParallelTestScenario [ ] = generateParallelTests ( ) ;
1811
1912suite ( 'deployWorkspaceProject' , async function ( this : Mocha . Suite ) {
2013 this . timeout ( 15 * 60 * 1000 ) ;
@@ -24,13 +17,8 @@ suite('deployWorkspaceProject', async function (this: Mocha.Suite) {
2417 this . skip ( ) ;
2518 }
2619
27- // Create a container registry & managed environment first so that we can guarantee one is always built before workspace deployment tests start.
28- // This is crucial for test consistency because some resource prompts will skip if no existing resources exist to choose from
29- // Creating at least one of each resource first ensures consistent reproduceability.
30- setupTask = setupResources ( ) ;
31-
3220 for ( const s of testScenarios ) {
33- s . scenario = s . callback ( setupTask ) ;
21+ s . scenario = s . callback ( ) ;
3422 }
3523 } ) ;
3624
@@ -40,39 +28,3 @@ suite('deployWorkspaceProject', async function (this: Mocha.Suite) {
4028 } ) ;
4129 }
4230} ) ;
43-
44- async function setupResources ( ) : Promise < void > {
45- let envResourceTask : Promise < void > | undefined ;
46- let managedEnvironment : ManagedEnvironment | undefined ;
47- try {
48- envResourceTask = runWithTestActionContext ( 'createManagedEnvironment' , async context => {
49- const resourceName : string = 'dwp' + randomUtils . getRandomHexString ( 6 ) ;
50- await context . ui . runWithInputs ( [ resourceName , 'East US' ] , async ( ) => {
51- managedEnvironment = await createManagedEnvironment ( context ) ;
52- } ) ;
53- } ) ;
54- } catch ( e ) {
55- console . error ( e ) ;
56- }
57-
58- let acrResourceTask : Promise < void > | undefined ;
59- let registry : Registry | undefined ;
60- try {
61- acrResourceTask = runWithTestActionContext ( 'createContainerRegistry' , async context => {
62- const resourceName : string = 'dwp' + randomUtils . getRandomHexString ( 6 ) ;
63- await context . ui . runWithInputs ( [ resourceName , 'Basic' , 'East US' ] , async ( ) => {
64- registry = await createAcr ( context ) ;
65- } ) ;
66- } ) ;
67- } catch ( e ) {
68- console . error ( e ) ;
69- }
70-
71- await Promise . allSettled ( [ envResourceTask , acrResourceTask ] ) ;
72-
73- assert . ok ( managedEnvironment , 'Failed to create managed environment - skipping "deployWorkspaceProject" tests.' ) ;
74- resourceGroupsToDelete . add ( nonNullProp ( managedEnvironment , 'name' ) ) ;
75-
76- assert . ok ( registry , 'Failed to create container registry - skipping "deployWorkspaceProject" tests.' ) ;
77- resourceGroupsToDelete . add ( nonNullProp ( registry , 'name' ) ) ;
78- }
0 commit comments