diff --git a/test/global.test.ts b/test/global.test.ts index 08463702e..176ece817 100644 --- a/test/global.test.ts +++ b/test/global.test.ts @@ -9,8 +9,8 @@ import * as assert from 'assert'; import * as vscode from 'vscode'; import { ext, registerOnActionStartHandler, registerUIExtensionVariables } from '../extension.bundle'; -const longRunningLocalTestsEnabled: boolean = !/^(false|0)?$/i.test(process.env.AzCode_EnableLongRunningTestsLocal || ''); -const longRunningRemoteTestsEnabled: boolean = !/^(false|0)?$/i.test(process.env.AzCode_UseAzureFederatedCredentials || ''); +export const longRunningLocalTestsEnabled: boolean = !/^(false|0)?$/i.test(process.env.AzCode_EnableLongRunningTestsLocal || ''); +export const longRunningRemoteTestsEnabled: boolean = !/^(false|0)?$/i.test(process.env.AzCode_UseAzureFederatedCredentials || ''); export const longRunningTestsEnabled: boolean = longRunningLocalTestsEnabled || longRunningRemoteTestsEnabled; diff --git a/test/nightly/deployWorkspaceProject/buildParallelScenarios.ts b/test/nightly/deployWorkspaceProject/buildParallelScenarios.ts index 680b16b94..87b9ac5ef 100644 --- a/test/nightly/deployWorkspaceProject/buildParallelScenarios.ts +++ b/test/nightly/deployWorkspaceProject/buildParallelScenarios.ts @@ -10,7 +10,7 @@ import { workspace, type Uri, type WorkspaceFolder } from "vscode"; import { AzExtFsExtra, deployWorkspaceProject, dwpSettingUtilsV2, ext, parseError, settingUtils, type DeploymentConfigurationSettings, type DeployWorkspaceProjectResults, type IParsedError } from "../../../extension.bundle"; import { assertStringPropsMatch, getWorkspaceFolderUri } from "../../testUtils"; import { resourceGroupsToDelete } from "../global.nightly.test"; -import { dwpTestScenarios, type DeployWorkspaceProjectTestScenario } from "./dwpTestScenarios"; +import { getDwpTestScenarios, type DeployWorkspaceProjectTestScenario } from "./dwpTestScenarios"; export interface DwpParallelTestScenario { title: string; @@ -19,7 +19,7 @@ export interface DwpParallelTestScenario { } export function buildParallelTestScenarios(): DwpParallelTestScenario[] { - return dwpTestScenarios.map(scenario => { + return getDwpTestScenarios().map(scenario => { return { title: scenario.label, callback: buildParallelScenarioCallback(scenario), diff --git a/test/nightly/deployWorkspaceProject/dwpTestScenarios.ts b/test/nightly/deployWorkspaceProject/dwpTestScenarios.ts index 38e0643fe..8f631e3ff 100644 --- a/test/nightly/deployWorkspaceProject/dwpTestScenarios.ts +++ b/test/nightly/deployWorkspaceProject/dwpTestScenarios.ts @@ -3,9 +3,11 @@ * Licensed under the MIT License. See LICENSE.md in the project root for license information. *--------------------------------------------------------------------------------------------*/ +import { longRunningLocalTestsEnabled } from "../../global.test"; import { generateAlbumApiJavaScriptTestCases } from "./testCases/albumApiJavaScriptTestCases"; import { type DeployWorkspaceProjectTestCase } from "./testCases/DeployWorkspaceProjectTestCase"; -import { generateMonoRepoBasicTestCases } from "./testCases/monoRepoBasicTestCases"; +import { generateMonoRepoAdminCredentialsTestCases } from "./testCases/monoRepoTestCases/adminCredentialsTestCases"; +import { generateMonoRepoIdentityTestCases } from "./testCases/monoRepoTestCases/identityTestCases"; export interface DeployWorkspaceProjectTestScenario { label: string; @@ -13,15 +15,30 @@ export interface DeployWorkspaceProjectTestScenario { testCases: DeployWorkspaceProjectTestCase[]; } -export const dwpTestScenarios: DeployWorkspaceProjectTestScenario[] = [ - { - label: 'albumapi-js', - folderName: 'albumapi-js', - testCases: generateAlbumApiJavaScriptTestCases() - }, - { - label: 'monorepo', - folderName: 'monorepo-basic', - testCases: generateMonoRepoBasicTestCases() - }, -]; +export function getDwpTestScenarios(): DeployWorkspaceProjectTestScenario[] { + const dwpTestScenarios: DeployWorkspaceProjectTestScenario[] = [ + { + label: 'albumapi-js', + folderName: 'albumapi-js', + testCases: generateAlbumApiJavaScriptTestCases(), + }, + { + label: 'monorepo-admincreds', + folderName: 'monorepo-admincreds', + testCases: generateMonoRepoAdminCredentialsTestCases(), + }, + ]; + + if (longRunningLocalTestsEnabled) { + // Insufficient auth privilege to test managed identity / role assignment in our manual testing subscription. + // Therefore, limit these tests to only run locally in personal subscriptions where user has full permission to assign roles. + // Todo: Investigate if it makes sense to elevate remote privileges such that these tests can also be automated to run remotely. + dwpTestScenarios.push({ + label: 'monorepo-identity', + folderName: 'monorepo-identity', + testCases: generateMonoRepoIdentityTestCases(), + }); + } + + return dwpTestScenarios; +} diff --git a/test/nightly/deployWorkspaceProject/dwpTestUtils.ts b/test/nightly/deployWorkspaceProject/dwpTestUtils.ts index c99acf8b5..86d264465 100644 --- a/test/nightly/deployWorkspaceProject/dwpTestUtils.ts +++ b/test/nightly/deployWorkspaceProject/dwpTestUtils.ts @@ -13,7 +13,7 @@ import { subscriptionContext } from "../global.nightly.test"; import { type PostTestAssertion } from "./testCases/DeployWorkspaceProjectTestCase"; export namespace dwpTestUtils { - export function generateExpectedResults(sharedResourceName: string, acrResourceName: string, appResourceName: string): StringOrRegExpProps { + export function generateExpectedResultsWithCredentials(sharedResourceName: string, acrResourceName: string, appResourceName: string): StringOrRegExpProps { return { containerAppId: new RegExp(`\/resourceGroups\/${sharedResourceName}\/providers\/Microsoft\.App\/containerApps\/${appResourceName}`, 'i'), imageName: new RegExp(appResourceName, 'i'), @@ -27,6 +27,20 @@ export namespace dwpTestUtils { }; } + export function generateExpectedResultsWithoutCredentials(sharedResourceName: string, acrResourceName: string, appResourceName: string): StringOrRegExpProps { + return { + containerAppId: new RegExp(`\/resourceGroups\/${sharedResourceName}\/providers\/Microsoft\.App\/containerApps\/${appResourceName}`, 'i'), + imageName: new RegExp(appResourceName, 'i'), + logAnalyticsWorkspaceId: new RegExp(`\/resourceGroups\/${sharedResourceName}\/providers\/Microsoft\.OperationalInsights\/workspaces\/${sharedResourceName}`, 'i'), + managedEnvironmentId: new RegExp(`\/resourceGroups\/${sharedResourceName}\/providers\/Microsoft\.App\/managedEnvironments\/${sharedResourceName}`, 'i'), + registryId: new RegExp(`\/resourceGroups\/${sharedResourceName}\/providers\/Microsoft\.ContainerRegistry\/registries\/${acrResourceName}.{6}`, 'i'), + registryLoginServer: new RegExp(`${acrResourceName}.{6}\.azurecr\.io`, 'i'), + registryPassword: undefined, + registryUsername: undefined, + resourceGroupId: new RegExp(`\/resourceGroups\/${sharedResourceName}`, 'i') + }; + } + export function generatePostTestAssertion(expectedContainerAppSettings: { targetPort: number | undefined, env: EnvironmentVar[] | undefined }): PostTestAssertion { return async function postTestAssertion(context: IActionContext, resources: DeployWorkspaceProjectResults, errMsg?: string): Promise { const parsedId = parseAzureResourceId(nonNullProp(resources, 'containerAppId')); diff --git a/test/nightly/deployWorkspaceProject/testCases/albumApiJavaScriptTestCases.ts b/test/nightly/deployWorkspaceProject/testCases/albumApiJavaScriptTestCases.ts index 9c25415fd..34ab28ea1 100644 --- a/test/nightly/deployWorkspaceProject/testCases/albumApiJavaScriptTestCases.ts +++ b/test/nightly/deployWorkspaceProject/testCases/albumApiJavaScriptTestCases.ts @@ -52,7 +52,7 @@ export function generateAlbumApiJavaScriptTestCases(): DeployWorkspaceProjectTes 'East US', 'Save' ], - expectedResults: dwpTestUtils.generateExpectedResults(sharedResourceName, acrResourceName, appResourceName), + expectedResults: dwpTestUtils.generateExpectedResultsWithCredentials(sharedResourceName, acrResourceName, appResourceName), expectedVSCodeSettings: { deploymentConfigurations: [ generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, appResourceName) @@ -68,7 +68,7 @@ export function generateAlbumApiJavaScriptTestCases(): DeployWorkspaceProjectTes appResourceName, 'Continue' ], - expectedResults: dwpTestUtils.generateExpectedResults(sharedResourceName, acrResourceName, appResourceName), + expectedResults: dwpTestUtils.generateExpectedResultsWithCredentials(sharedResourceName, acrResourceName, appResourceName), expectedVSCodeSettings: { deploymentConfigurations: [ generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, appResourceName) diff --git a/test/nightly/deployWorkspaceProject/testCases/monoRepoBasicTestCases.ts b/test/nightly/deployWorkspaceProject/testCases/monoRepoTestCases/adminCredentialsTestCases.ts similarity index 78% rename from test/nightly/deployWorkspaceProject/testCases/monoRepoBasicTestCases.ts rename to test/nightly/deployWorkspaceProject/testCases/monoRepoTestCases/adminCredentialsTestCases.ts index 220eebd68..9fe15e49f 100644 --- a/test/nightly/deployWorkspaceProject/testCases/monoRepoBasicTestCases.ts +++ b/test/nightly/deployWorkspaceProject/testCases/monoRepoTestCases/adminCredentialsTestCases.ts @@ -5,14 +5,13 @@ import { randomUtils } from "@microsoft/vscode-azext-utils"; import * as path from "path"; -import { type DeploymentConfigurationSettings } from "../../../../extension.bundle"; -import { type StringOrRegExpProps } from "../../../typeUtils"; -import { dwpTestUtils } from "../dwpTestUtils"; -import { type DeployWorkspaceProjectTestCase } from "./DeployWorkspaceProjectTestCase"; +import { dwpTestUtils } from "../../dwpTestUtils"; +import { type DeployWorkspaceProjectTestCase } from "../DeployWorkspaceProjectTestCase"; +import { generateExpectedDeploymentConfiguration } from "./generateExpectedDeploymentConfiguration"; -export function generateMonoRepoBasicTestCases(): DeployWorkspaceProjectTestCase[] { - const folderName: string = 'monorepo-basic'; - const sharedResourceName: string = 'monorepo-basic' + randomUtils.getRandomHexString(4); +export function generateMonoRepoAdminCredentialsTestCases(): DeployWorkspaceProjectTestCase[] { + const folderName: string = 'monorepo-admincreds'; + const sharedResourceName: string = 'monorepo-ac' + randomUtils.getRandomHexString(4); const acrResourceName: string = sharedResourceName.replace(/[^a-zA-Z0-9]+/g, ''); return [ @@ -32,7 +31,7 @@ export function generateMonoRepoBasicTestCases(): DeployWorkspaceProjectTestCase 'East US', 'Save' ], - expectedResults: dwpTestUtils.generateExpectedResults(sharedResourceName, acrResourceName, 'app1'), + expectedResults: dwpTestUtils.generateExpectedResultsWithCredentials(sharedResourceName, acrResourceName, 'app1'), expectedVSCodeSettings: { deploymentConfigurations: [ generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app1') @@ -55,7 +54,7 @@ export function generateMonoRepoBasicTestCases(): DeployWorkspaceProjectTestCase path.join('app2', '.env.example'), 'Save' ], - expectedResults: dwpTestUtils.generateExpectedResults(sharedResourceName, acrResourceName, 'app2'), + expectedResults: dwpTestUtils.generateExpectedResultsWithCredentials(sharedResourceName, acrResourceName, 'app2'), expectedVSCodeSettings: { deploymentConfigurations: [ generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app1'), @@ -78,7 +77,7 @@ export function generateMonoRepoBasicTestCases(): DeployWorkspaceProjectTestCase path.join('app3', '.env.example'), 'Save' ], - expectedResults: dwpTestUtils.generateExpectedResults(sharedResourceName, acrResourceName, 'app3'), + expectedResults: dwpTestUtils.generateExpectedResultsWithCredentials(sharedResourceName, acrResourceName, 'app3'), expectedVSCodeSettings: { deploymentConfigurations: [ generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app1'), @@ -95,7 +94,7 @@ export function generateMonoRepoBasicTestCases(): DeployWorkspaceProjectTestCase 'app1', 'Continue' ], - expectedResults: dwpTestUtils.generateExpectedResults(sharedResourceName, acrResourceName, 'app1'), + expectedResults: dwpTestUtils.generateExpectedResultsWithCredentials(sharedResourceName, acrResourceName, 'app1'), expectedVSCodeSettings: { deploymentConfigurations: [ generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app1'), @@ -107,16 +106,3 @@ export function generateMonoRepoBasicTestCases(): DeployWorkspaceProjectTestCase } ]; } - -function generateExpectedDeploymentConfiguration(sharedResourceName: string, acrResourceName: string, appResourceName: string): StringOrRegExpProps { - return { - label: appResourceName, - type: 'AcrDockerBuildRequest', - dockerfilePath: path.join(appResourceName, 'Dockerfile'), - srcPath: appResourceName, - envPath: path.join(appResourceName, '.env.example'), - resourceGroup: sharedResourceName, - containerApp: appResourceName, - containerRegistry: new RegExp(`${acrResourceName}.{6}`, 'i'), - }; -} diff --git a/test/nightly/deployWorkspaceProject/testCases/monoRepoTestCases/generateExpectedDeploymentConfiguration.ts b/test/nightly/deployWorkspaceProject/testCases/monoRepoTestCases/generateExpectedDeploymentConfiguration.ts new file mode 100644 index 000000000..d9b226da3 --- /dev/null +++ b/test/nightly/deployWorkspaceProject/testCases/monoRepoTestCases/generateExpectedDeploymentConfiguration.ts @@ -0,0 +1,16 @@ +import * as path from "path"; +import { type DeploymentConfigurationSettings } from "../../../../../extension.bundle"; +import { type StringOrRegExpProps } from "../../../../typeUtils"; + +export function generateExpectedDeploymentConfiguration(sharedResourceName: string, acrResourceName: string, appResourceName: string): StringOrRegExpProps { + return { + label: appResourceName, + type: 'AcrDockerBuildRequest', + dockerfilePath: path.join(appResourceName, 'Dockerfile'), + srcPath: appResourceName, + envPath: path.join(appResourceName, '.env.example'), + resourceGroup: sharedResourceName, + containerApp: appResourceName, + containerRegistry: new RegExp(`${acrResourceName}.{6}`, 'i'), + }; +} diff --git a/test/nightly/deployWorkspaceProject/testCases/monoRepoTestCases/identityTestCases.ts b/test/nightly/deployWorkspaceProject/testCases/monoRepoTestCases/identityTestCases.ts new file mode 100644 index 000000000..4d1859cdc --- /dev/null +++ b/test/nightly/deployWorkspaceProject/testCases/monoRepoTestCases/identityTestCases.ts @@ -0,0 +1,107 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See LICENSE.md in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import { randomUtils } from "@microsoft/vscode-azext-utils"; +import * as path from "path"; +import { dwpTestUtils } from "../../dwpTestUtils"; +import { type DeployWorkspaceProjectTestCase } from "../DeployWorkspaceProjectTestCase"; +import { generateExpectedDeploymentConfiguration } from "./generateExpectedDeploymentConfiguration"; + +export function generateMonoRepoIdentityTestCases(): DeployWorkspaceProjectTestCase[] { + const folderName: string = 'monorepo-identity'; + const sharedResourceName: string = 'monorepo-id' + randomUtils.getRandomHexString(4); + const acrResourceName: string = sharedResourceName.replace(/[^a-zA-Z0-9]+/g, ''); + + return [ + { + label: "Deploy App 1", + inputs: [ + new RegExp(folderName, 'i'), + path.join('app1', 'Dockerfile'), + new RegExp('Create new container apps environment', 'i'), + 'Continue', + sharedResourceName, + 'app1', + `.${path.sep}app1`, + 'Managed Identity', + path.join('app1', '.env.example'), + 'East US', + 'Save' + ], + expectedResults: dwpTestUtils.generateExpectedResultsWithoutCredentials(sharedResourceName, acrResourceName, 'app1'), + expectedVSCodeSettings: { + deploymentConfigurations: [ + generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app1') + ] + }, + postTestAssertion: dwpTestUtils.generatePostTestAssertion({ targetPort: 3000, env: [{ name: 'MESSAGE', value: 'container apps (app1)' }] }), + resourceGroupToDelete: sharedResourceName + }, + { + label: "Deploy App 2", + inputs: [ + new RegExp(folderName, 'i'), + new RegExp('Create and deploy new app configuration', 'i'), + path.join('app2', 'Dockerfile'), + new RegExp('(Recommended)', 'i'), // Select a container app environment + 'Continue', + 'app2', + `.${path.sep}app2`, + 'Managed Identity', + path.join('app2', '.env.example'), + 'Save' + ], + expectedResults: dwpTestUtils.generateExpectedResultsWithoutCredentials(sharedResourceName, acrResourceName, 'app2'), + expectedVSCodeSettings: { + deploymentConfigurations: [ + generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app1'), + generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app2'), + ] + }, + postTestAssertion: dwpTestUtils.generatePostTestAssertion({ targetPort: 3001, env: [{ name: 'MESSAGE', value: 'container apps (app2)' }] }) + }, + { + label: "Deploy App 3", + inputs: [ + new RegExp(folderName, 'i'), + new RegExp('Create and deploy new app configuration', 'i'), + path.join('app3', 'Dockerfile'), + new RegExp('(Recommended)', 'i'), // Select a container app environment + 'Continue', + 'app3', + `.${path.sep}app3`, + 'Managed Identity', + path.join('app3', '.env.example'), + 'Save' + ], + expectedResults: dwpTestUtils.generateExpectedResultsWithoutCredentials(sharedResourceName, acrResourceName, 'app3'), + expectedVSCodeSettings: { + deploymentConfigurations: [ + generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app1'), + generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app2'), + generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app3'), + ] + }, + postTestAssertion: dwpTestUtils.generatePostTestAssertion({ targetPort: 3002, env: [{ name: 'MESSAGE', value: 'container apps (app3)' }] }), + }, + { + label: "Re-deploy App 1", + inputs: [ + new RegExp(folderName, 'i'), + 'app1', + 'Continue' + ], + expectedResults: dwpTestUtils.generateExpectedResultsWithoutCredentials(sharedResourceName, acrResourceName, 'app1'), + expectedVSCodeSettings: { + deploymentConfigurations: [ + generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app1'), + generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app2'), + generateExpectedDeploymentConfiguration(sharedResourceName, acrResourceName, 'app3'), + ] + }, + postTestAssertion: dwpTestUtils.generatePostTestAssertion({ targetPort: 3000, env: [{ name: 'MESSAGE', value: 'container apps (app1)' }] }) + } + ]; +} diff --git a/test/test.code-workspace b/test/test.code-workspace index 89ee2890c..87e949684 100644 --- a/test/test.code-workspace +++ b/test/test.code-workspace @@ -9,8 +9,12 @@ "path": "./testProjects/dockerfiles" }, { - "name": "monorepo-basic", - "path": "./testProjects/monorepo-basic" + "name": "monorepo-admincreds", + "path": "./testProjects/monorepo-basic-1" }, + { + "name": "monorepo-identity", + "path": "./testProjects/monorepo-basic-2" + } ] } diff --git a/test/testProjects/monorepo-basic/.gitignore b/test/testProjects/monorepo-basic-1/.gitignore similarity index 100% rename from test/testProjects/monorepo-basic/.gitignore rename to test/testProjects/monorepo-basic-1/.gitignore diff --git a/test/testProjects/monorepo-basic/README.md b/test/testProjects/monorepo-basic-1/README.md similarity index 100% rename from test/testProjects/monorepo-basic/README.md rename to test/testProjects/monorepo-basic-1/README.md diff --git a/test/testProjects/monorepo-basic/app1/.env.example b/test/testProjects/monorepo-basic-1/app1/.env.example similarity index 100% rename from test/testProjects/monorepo-basic/app1/.env.example rename to test/testProjects/monorepo-basic-1/app1/.env.example diff --git a/test/testProjects/monorepo-basic/app1/Dockerfile b/test/testProjects/monorepo-basic-1/app1/Dockerfile similarity index 100% rename from test/testProjects/monorepo-basic/app1/Dockerfile rename to test/testProjects/monorepo-basic-1/app1/Dockerfile diff --git a/test/testProjects/monorepo-basic/app1/package.json b/test/testProjects/monorepo-basic-1/app1/package.json similarity index 100% rename from test/testProjects/monorepo-basic/app1/package.json rename to test/testProjects/monorepo-basic-1/app1/package.json diff --git a/test/testProjects/monorepo-basic/app1/server.js b/test/testProjects/monorepo-basic-1/app1/server.js similarity index 100% rename from test/testProjects/monorepo-basic/app1/server.js rename to test/testProjects/monorepo-basic-1/app1/server.js diff --git a/test/testProjects/monorepo-basic/app2/.env.example b/test/testProjects/monorepo-basic-1/app2/.env.example similarity index 100% rename from test/testProjects/monorepo-basic/app2/.env.example rename to test/testProjects/monorepo-basic-1/app2/.env.example diff --git a/test/testProjects/monorepo-basic/app2/Dockerfile b/test/testProjects/monorepo-basic-1/app2/Dockerfile similarity index 100% rename from test/testProjects/monorepo-basic/app2/Dockerfile rename to test/testProjects/monorepo-basic-1/app2/Dockerfile diff --git a/test/testProjects/monorepo-basic/app2/package.json b/test/testProjects/monorepo-basic-1/app2/package.json similarity index 100% rename from test/testProjects/monorepo-basic/app2/package.json rename to test/testProjects/monorepo-basic-1/app2/package.json diff --git a/test/testProjects/monorepo-basic/app2/server.js b/test/testProjects/monorepo-basic-1/app2/server.js similarity index 100% rename from test/testProjects/monorepo-basic/app2/server.js rename to test/testProjects/monorepo-basic-1/app2/server.js diff --git a/test/testProjects/monorepo-basic/app3/.env.example b/test/testProjects/monorepo-basic-1/app3/.env.example similarity index 100% rename from test/testProjects/monorepo-basic/app3/.env.example rename to test/testProjects/monorepo-basic-1/app3/.env.example diff --git a/test/testProjects/monorepo-basic/app3/Dockerfile b/test/testProjects/monorepo-basic-1/app3/Dockerfile similarity index 100% rename from test/testProjects/monorepo-basic/app3/Dockerfile rename to test/testProjects/monorepo-basic-1/app3/Dockerfile diff --git a/test/testProjects/monorepo-basic/app3/package.json b/test/testProjects/monorepo-basic-1/app3/package.json similarity index 100% rename from test/testProjects/monorepo-basic/app3/package.json rename to test/testProjects/monorepo-basic-1/app3/package.json diff --git a/test/testProjects/monorepo-basic/app3/server.js b/test/testProjects/monorepo-basic-1/app3/server.js similarity index 100% rename from test/testProjects/monorepo-basic/app3/server.js rename to test/testProjects/monorepo-basic-1/app3/server.js diff --git a/test/testProjects/monorepo-basic-2/.gitignore b/test/testProjects/monorepo-basic-2/.gitignore new file mode 100644 index 000000000..76efb07fd --- /dev/null +++ b/test/testProjects/monorepo-basic-2/.gitignore @@ -0,0 +1,2 @@ +node_modules +.vscode diff --git a/test/testProjects/monorepo-basic-2/README.md b/test/testProjects/monorepo-basic-2/README.md new file mode 100644 index 000000000..3f02450f1 --- /dev/null +++ b/test/testProjects/monorepo-basic-2/README.md @@ -0,0 +1,3 @@ +# Monorepo-basic + +This extremely minimal Node.js monorepo is used for quickly testing simple scenarios in the Azure Container Apps Extension. diff --git a/test/testProjects/monorepo-basic-2/app1/.env.example b/test/testProjects/monorepo-basic-2/app1/.env.example new file mode 100644 index 000000000..9774d4ca3 --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app1/.env.example @@ -0,0 +1 @@ +MESSAGE='container apps (app1)' diff --git a/test/testProjects/monorepo-basic-2/app1/Dockerfile b/test/testProjects/monorepo-basic-2/app1/Dockerfile new file mode 100644 index 000000000..7551b0939 --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app1/Dockerfile @@ -0,0 +1,6 @@ +FROM node:lts-alpine + +COPY . /src +RUN cd /src && npm install +EXPOSE 3000 +CMD ["node", "/src/server.js"] diff --git a/test/testProjects/monorepo-basic-2/app1/package.json b/test/testProjects/monorepo-basic-2/app1/package.json new file mode 100644 index 000000000..73a19ffec --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app1/package.json @@ -0,0 +1,9 @@ +{ + "name": "aca-hello-world-app1", + "version": "1.0.0", + "description": "Simple test app for the ACA tools for VS Code extension", + "main": "server.js", + "scripts": { + "start": "node server.js" + } +} diff --git a/test/testProjects/monorepo-basic-2/app1/server.js b/test/testProjects/monorepo-basic-2/app1/server.js new file mode 100644 index 000000000..112d7be02 --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app1/server.js @@ -0,0 +1,12 @@ +const http = require('http'); + +const port = process.env.PORT || 3000; +const message = process.env.MESSAGE || 'world'; + +const server = http.createServer((_, res) => { + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.write(`Hello ${message}\n`); +}); + +server.listen(port); +console.log(`Server running at http://localhost: ${port}`); diff --git a/test/testProjects/monorepo-basic-2/app2/.env.example b/test/testProjects/monorepo-basic-2/app2/.env.example new file mode 100644 index 000000000..6169562de --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app2/.env.example @@ -0,0 +1 @@ +MESSAGE='container apps (app2)' diff --git a/test/testProjects/monorepo-basic-2/app2/Dockerfile b/test/testProjects/monorepo-basic-2/app2/Dockerfile new file mode 100644 index 000000000..5eebedd05 --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app2/Dockerfile @@ -0,0 +1,6 @@ +FROM node:lts-alpine + +COPY . /src +RUN cd /src && npm install +EXPOSE 3001 +CMD ["node", "/src/server.js"] diff --git a/test/testProjects/monorepo-basic-2/app2/package.json b/test/testProjects/monorepo-basic-2/app2/package.json new file mode 100644 index 000000000..ac888411b --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app2/package.json @@ -0,0 +1,9 @@ +{ + "name": "aca-hello-world-app2", + "version": "1.0.0", + "description": "Simple test app for the ACA tools for VS Code extension", + "main": "server.js", + "scripts": { + "start": "node server.js" + } +} diff --git a/test/testProjects/monorepo-basic-2/app2/server.js b/test/testProjects/monorepo-basic-2/app2/server.js new file mode 100644 index 000000000..abccb6a24 --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app2/server.js @@ -0,0 +1,12 @@ +const http = require('http'); + +const port = process.env.PORT || 3001; +const message = process.env.MESSAGE || 'world'; + +const server = http.createServer((_, res) => { + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.write(`Hello ${message}\n`); +}); + +server.listen(port); +console.log(`Server running at http://localhost: ${port}`); diff --git a/test/testProjects/monorepo-basic-2/app3/.env.example b/test/testProjects/monorepo-basic-2/app3/.env.example new file mode 100644 index 000000000..b653a1fe5 --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app3/.env.example @@ -0,0 +1 @@ +MESSAGE='container apps (app3)' diff --git a/test/testProjects/monorepo-basic-2/app3/Dockerfile b/test/testProjects/monorepo-basic-2/app3/Dockerfile new file mode 100644 index 000000000..252ccdcc7 --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app3/Dockerfile @@ -0,0 +1,6 @@ +FROM node:lts-alpine + +COPY . /src +RUN cd /src && npm install +EXPOSE 3002 +CMD ["node", "/src/server.js"] diff --git a/test/testProjects/monorepo-basic-2/app3/package.json b/test/testProjects/monorepo-basic-2/app3/package.json new file mode 100644 index 000000000..1b5b8b78d --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app3/package.json @@ -0,0 +1,9 @@ +{ + "name": "aca-hello-world-app3", + "version": "1.0.0", + "description": "Simple test app for the ACA tools for VS Code extension", + "main": "server.js", + "scripts": { + "start": "node server.js" + } +} diff --git a/test/testProjects/monorepo-basic-2/app3/server.js b/test/testProjects/monorepo-basic-2/app3/server.js new file mode 100644 index 000000000..afeae7f2a --- /dev/null +++ b/test/testProjects/monorepo-basic-2/app3/server.js @@ -0,0 +1,12 @@ +const http = require('http'); + +const port = process.env.PORT || 3002; +const message = process.env.MESSAGE || 'world'; + +const server = http.createServer((_, res) => { + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.write(`Hello ${message}\n`); +}); + +server.listen(port); +console.log(`Server running at http://localhost: ${port}`);