55
66import { type ServiceClient } from '@azure/core-client' ;
77import { createPipelineRequest } from '@azure/core-rest-pipeline' ;
8- import { createTestActionContext , runWithTestActionContext , type TestInput } from '@microsoft/vscode-azext-dev' ;
8+ import { TestInput , createTestActionContext , runWithTestActionContext } from '@microsoft/vscode-azext-dev' ;
99import { AzExtFsExtra } from '@microsoft/vscode-azext-utils' ;
1010import * as assert from 'assert' ;
1111import * as path from 'path' ;
1212import * as vscode from 'vscode' ;
13- import { FuncVersion , ProjectLanguage , copyFunctionUrl , createGenericClient , createNewProjectInternal , deployProductionSlot , getRandomHexString , nonNullProp } from '../../extension.bundle' ;
13+ import { FuncVersion , ProjectLanguage , copyFunctionUrl , createGenericClient , createNewProjectInternal , deployProductionSlot , getRandomAlphanumericString , getRandomHexString , nonNullProp } from '../../extension.bundle' ;
1414import { addParallelSuite , runInSeries , type ParallelTest } from '../addParallelSuite' ;
1515import { getTestWorkspaceFolder } from '../global.test' ;
1616import { NodeModelInput , NodeModelVersion , PythonModelInput , PythonModelVersion , defaultTestFuncVersion , getCSharpValidateOptions , getJavaScriptValidateOptions , getPowerShellValidateOptions , getPythonValidateOptions , getTypeScriptValidateOptions , validateProject , type IValidateProjectOptions } from '../project/validateProject' ;
@@ -23,18 +23,19 @@ interface CreateProjectAndDeployTestCase extends ICreateProjectAndDeployOptions
2323}
2424
2525const testCases : CreateProjectAndDeployTestCase [ ] = [
26- { title : 'JavaScript (Model V3)' , ...getJavaScriptValidateOptions ( true ) , createProjectInputs : [ NodeModelInput [ NodeModelVersion . v3 ] ] , deployInputs : [ getRotatingNodeVersion ( ) ] , languageModelVersion : NodeModelVersion . v3 } ,
27- { title : 'JavaScript (Model V4)' , ...getJavaScriptValidateOptions ( true , undefined , undefined , undefined , NodeModelVersion . v4 ) , createProjectInputs : [ NodeModelInput [ NodeModelVersion . v4 ] ] , deployInputs : [ getRotatingNodeVersion ( ) ] , languageModelVersion : NodeModelVersion . v4 } ,
28- { title : 'TypeScript (Model V3)' , ...getTypeScriptValidateOptions ( ) , createProjectInputs : [ NodeModelInput [ NodeModelVersion . v3 ] ] , deployInputs : [ getRotatingNodeVersion ( ) ] , languageModelVersion : NodeModelVersion . v3 } ,
29- { title : 'TypeScript (Model V4)' , ...getTypeScriptValidateOptions ( { modelVersion : NodeModelVersion . v4 } ) , createProjectInputs : [ NodeModelInput [ NodeModelVersion . v4 ] ] , deployInputs : [ getRotatingNodeVersion ( ) ] , languageModelVersion : NodeModelVersion . v4 } ,
26+ { title : 'JavaScript (Model V3)' , ...getJavaScriptValidateOptions ( true ) , createProjectInputs : [ NodeModelInput [ NodeModelVersion . v3 ] ] , deployInputs : [ getRotatingNodeVersion ( ) , TestInput . UseDefaultValue /* instance mem size*/ , TestInput . UseDefaultValue /*max instance*/ ] , languageModelVersion : NodeModelVersion . v3 } ,
27+ { title : 'JavaScript (Model V4)' , ...getJavaScriptValidateOptions ( true , undefined , undefined , undefined , NodeModelVersion . v4 ) , createProjectInputs : [ NodeModelInput [ NodeModelVersion . v4 ] ] , deployInputs : [ getRotatingNodeVersion ( ) , TestInput . UseDefaultValue /* instance mem size*/ , TestInput . UseDefaultValue /*max instance*/ ] , languageModelVersion : NodeModelVersion . v4 } ,
28+ { title : 'TypeScript (Model V3)' , ...getTypeScriptValidateOptions ( ) , createProjectInputs : [ NodeModelInput [ NodeModelVersion . v3 ] ] , deployInputs : [ getRotatingNodeVersion ( ) , TestInput . UseDefaultValue /* instance mem size*/ , TestInput . UseDefaultValue /*max instance*/ ] , languageModelVersion : NodeModelVersion . v3 } ,
29+ { title : 'TypeScript (Model V4)' , ...getTypeScriptValidateOptions ( { modelVersion : NodeModelVersion . v4 } ) , createProjectInputs : [ NodeModelInput [ NodeModelVersion . v4 ] ] , deployInputs : [ getRotatingNodeVersion ( ) , TestInput . UseDefaultValue /* instance mem size*/ , TestInput . UseDefaultValue /*max instance*/ ] , languageModelVersion : NodeModelVersion . v4 } ,
3030 // Temporarily disable Ballerina tests until we can install Ballerina on the new pipelines
3131 // https://github.com/microsoft/vscode-azurefunctions/issues/4210
3232 // { title: 'Ballerina', ...getBallerinaValidateOptions(), createProjectInputs: ["JVM"], deployInputs: [/java.*11/i] },
33- { title : 'C# .NET Framework' , buildMachineOsToSkip : 'darwin' , ...getCSharpValidateOptions ( 'net48' ) , createProjectInputs : [ / n e t .* F r a m e w o r k / i] , deployInputs : [ / n e t .* F r a m e w o r k / i] , createFunctionInputs : [ 'Company.Function' ] } ,
34- { title : 'C# .NET 8' , ...getCSharpValidateOptions ( 'net8.0' , FuncVersion . v4 ) , createProjectInputs : [ / n e t .* 8 / i] , deployInputs : [ / n e t .* 8 / i] , createFunctionInputs : [ 'Company.Function' ] } ,
35- { title : 'PowerShell' , ...getPowerShellValidateOptions ( ) , deployInputs : [ / p o w e r s h e l l .* 7 .4 / i] } ,
36- { title : 'Python (Model V1)' , ...getPythonValidateOptions ( '.venv' ) , createProjectInputs : [ PythonModelInput [ PythonModelVersion . v1 ] , / 3 \. 9 / ] , deployInputs : [ getRotatingPythonVersion ( ) ] , languageModelVersion : PythonModelVersion . v1 } ,
37- { title : 'Python (Model V2)' , ...getPythonValidateOptions ( '.venv' , undefined , PythonModelVersion . v2 ) , createProjectInputs : [ PythonModelInput [ PythonModelVersion . v2 ] , / 3 \. 9 / ] , deployInputs : [ getRotatingPythonVersion ( ) ] , languageModelVersion : PythonModelVersion . v2 } ,
33+ { title : 'C# .NET 8' , ...getCSharpValidateOptions ( 'net8.0' , FuncVersion . v4 ) , createProjectInputs : [ / n e t .* 8 / i] , deployInputs : [ / n e t .* 8 / i, TestInput . UseDefaultValue /* instance mem size*/ , TestInput . UseDefaultValue /*max instance*/ ] , createFunctionInputs : [ 'Company.Function' ] } ,
34+ // Temporarily disable .NET 9 test for now; it seems to break after running clean release (functions)
35+ // { title: 'C# .NET 9', ...getCSharpValidateOptions('net9.0', FuncVersion.v4), createProjectInputs: [/net.*9/i], deployInputs: [/net.*9/i, TestInput.UseDefaultValue /* instance mem size*/, TestInput.UseDefaultValue /*max instance*/], createFunctionInputs: ['Company.Function'] },
36+ { title : 'PowerShell' , ...getPowerShellValidateOptions ( ) , deployInputs : [ / p o w e r s h e l l .* 7 .4 / i, TestInput . UseDefaultValue /* instance mem size*/ , TestInput . UseDefaultValue /*max instance*/ ] } ,
37+ { title : 'Python (Model V1)' , ...getPythonValidateOptions ( '.venv' ) , createProjectInputs : [ PythonModelInput [ PythonModelVersion . v1 ] , / p y / ] , deployInputs : [ getRotatingPythonVersion ( ) , TestInput . UseDefaultValue /* instance mem size*/ , TestInput . UseDefaultValue /*max instance*/ ] , languageModelVersion : PythonModelVersion . v1 } ,
38+ { title : 'Python (Model V2)' , ...getPythonValidateOptions ( '.venv' , undefined , PythonModelVersion . v2 ) , createProjectInputs : [ PythonModelInput [ PythonModelVersion . v2 ] , / p y / ] , deployInputs : [ getRotatingPythonVersion ( ) , TestInput . UseDefaultValue /* instance mem size*/ , TestInput . UseDefaultValue /*max instance*/ ] , languageModelVersion : PythonModelVersion . v2 } ,
3839]
3940
4041const parallelTests : ParallelTest [ ] = [ ] ;
@@ -63,7 +64,7 @@ interface ICreateProjectAndDeployOptions extends IValidateProjectOptions {
6364}
6465
6566async function testCreateProjectAndDeploy ( options : ICreateProjectAndDeployOptions ) : Promise < void > {
66- const functionName : string = 'func ' + getRandomHexString ( ) ; // function name must start with a letter
67+ const functionName : string = 'f ' + getRandomAlphanumericString ( ) ; // function name must only contain alphanumeric
6768
6869 const testWorkspacePath = getTestWorkspaceFolder ( ) ;
6970 await runWithTestActionContext ( 'createNewProject' , async context => {
@@ -86,11 +87,13 @@ async function testCreateProjectAndDeploy(options: ICreateProjectAndDeployOption
8687 const routePrefix : string = getRandomHexString ( ) ;
8788 await addRoutePrefixToProject ( testWorkspacePath , routePrefix ) ;
8889
89- const appName : string = 'funcBasic' + getRandomHexString ( ) ;
90+ // TODO: investigate why our SDK calls are throwing errors when app name is over ~12 characters
91+ // https://github.com/microsoft/vscode-azurefunctions/issues/4368
92+ const appName : string = 'f' + getRandomAlphanumericString ( ) ;
9093 resourceGroupsToDelete . push ( appName ) ;
9194 await runWithTestActionContext ( 'deploy' , async context => {
9295 options . deployInputs = options . deployInputs || [ ] ;
93- await context . ui . runWithInputs ( [ testWorkspacePath , / c r e a t e n e w f u n c t i o n a p p / i, appName , ...options . deployInputs , getRotatingLocation ( ) ] , async ( ) => {
96+ await context . ui . runWithInputs ( [ testWorkspacePath , / c r e a t e n e w f u n c t i o n a p p / i, appName , getRotatingLocation ( ) , ...options . deployInputs ] , async ( ) => {
9497 await deployProductionSlot ( context )
9598 } ) ;
9699 } ) ;
0 commit comments