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

Add SqlBinding triggers to verified list #4358

Merged
merged 9 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
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
Binary file modified resources/backupTemplates/dotnet/~4/net6.0-isolated/item.nupkg
Binary file not shown.
Binary file modified resources/backupTemplates/dotnet/~4/net6.0-isolated/project.nupkg
Binary file not shown.
Binary file modified resources/backupTemplates/dotnet/~4/net6.0/item.nupkg
Binary file not shown.
Binary file modified resources/backupTemplates/dotnet/~4/net6.0/project.nupkg
Binary file not shown.
Binary file modified resources/backupTemplates/dotnet/~4/net7.0-isolated/item.nupkg
Binary file not shown.
Binary file modified resources/backupTemplates/dotnet/~4/net7.0-isolated/project.nupkg
Binary file not shown.
Binary file modified resources/backupTemplates/dotnet/~4/net8.0-isolated/item.nupkg
Binary file not shown.
Binary file modified resources/backupTemplates/dotnet/~4/net8.0-isolated/project.nupkg
Binary file not shown.
Binary file modified resources/backupTemplates/dotnet/~4/net9.0-isolated/item.nupkg
Binary file not shown.
Binary file modified resources/backupTemplates/dotnet/~4/net9.0-isolated/project.nupkg
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/backupTemplates/dotnet/~4/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.91.0
4.104.0
2 changes: 1 addition & 1 deletion resources/backupTemplates/script/~4/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.91.0
4.104.0
4 changes: 3 additions & 1 deletion src/templates/dotnet/getDotnetVerifiedTemplateIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export function getDotnetVerifiedTemplateIds(version: string): RegExp[] {
'EventGridCloudEventTrigger',
//TODO: Add unit test for EventGridBlobTrigger
'EventGridBlobTrigger',
'SqlInputBinding',
'SqlOutputBinding'
];

if (version === FuncVersion.v1) {
Expand All @@ -36,7 +38,7 @@ export function getDotnetVerifiedTemplateIds(version: string): RegExp[] {
}

return verifiedTemplateIds.map(id => {
return new RegExp(`^azure\\.function\\.csharp\\.(?:isolated\\.|)${id}\\.(?:Net(Core|Fx)\.|)[0-9]+\\.x$`, 'i');
return new RegExp(`^azure\\.function\\.csharp\\.(?:isolated\\.|)${id}((\\.(?:Net(Core|Fx)\.|)[0-9]+\\.x)|)$`, 'i');
});
}

3 changes: 2 additions & 1 deletion src/templates/script/getScriptVerifiedTemplateIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export function getScriptVerifiedTemplateIds(version: string): (string | RegExp)
'SendGrid',
'IoTHubTrigger',
//TODO: Add unit test for EventGridBlobTrigger
'EventGridBlobTrigger'
'EventGridBlobTrigger',
'SqlTrigger'
]);

// These languages are only supported in v2+ - same functions as JavaScript, with a few minor exceptions that aren't worth distinguishing here
Expand Down
21 changes: 18 additions & 3 deletions test/createFunction/createFunction.CSharp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ class CSharpFunctionTester extends FunctionTesterBase {
}

for (const source of backupLatestTemplateSources) {
addSuite(FuncVersion.v4, 'net6.0', source, true);
addSuite(FuncVersion.v4, 'net6.0', source, false);
addSuite(FuncVersion.v4, 'net7.0', source, true);
addSuite(FuncVersion.v4, 'net8.0', source, true);
addSuite(FuncVersion.v4, 'net9.0', source, true);
}

function addSuite(version: FuncVersion, targetFramework: string, source: TemplateSource, isIsolated?: boolean): void {
Expand Down Expand Up @@ -156,7 +155,23 @@ function addSuite(version: FuncVersion, targetFramework: string, source: Templat
'samples-workitems/name'
],
skip: !isIsolated
}
},
{
functionName: 'SqlInputBindingIsolated',
inputs: [
'TestCompany.TestFunction',
'AzureWebJobsStorage', // Use existing app setting
'TABLE'
]
},
{
functionName: 'SqlOutputBindingIsolated',
inputs: [
'TestCompany.TestFunction',
'AzureWebJobsStorage', // Use existing app setting
'TABLE'
]
},
];

const tester: CSharpFunctionTester = new CSharpFunctionTester(version, targetFramework, source, !!isIsolated);
Expand Down
10 changes: 9 additions & 1 deletion test/createFunction/createFunction.Script.v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,15 @@ function addSuite(tester: FunctionTesterBase): void {
'AzureWebJobsStorage', // Use existing app setting
'samples-workitems/name'
]
}
},
{
functionName: 'SQL Trigger',
inputs: [
'AzureWebJobsStorage', // Use existing app setting
'SqlConnectionString'
]
},

];

tester.addParallelSuite(testCases, {
Expand Down
7 changes: 2 additions & 5 deletions test/project/createNewProject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { runWithTestActionContext, TestInput } from '@microsoft/vscode-azext-dev';
import { runWithTestActionContext } from '@microsoft/vscode-azext-dev';
import { FuncVersion, JavaBuildTool, ProjectLanguage, TemplateSource } from '../../extension.bundle';
import { addParallelSuite, type ParallelTest } from '../addParallelSuite';
import { backupLatestTemplateSources, runForTemplateSource, shouldSkipVersion } from '../global.test';
import { createAndValidateProject, type ICreateProjectTestOptions } from './createAndValidateProject';
import { getCSharpValidateOptions, getCustomValidateOptions, getDotnetScriptValidateOptions, getJavaScriptValidateOptions, getPowerShellValidateOptions, getPythonValidateOptions, getTypeScriptValidateOptions, NodeModelInput, NodeModelVersion, PythonModelInput, PythonModelVersion } from './validateProject';
import { getCSharpValidateOptions, getCustomValidateOptions, getDotnetScriptValidateOptions, getJavaScriptValidateOptions, getPowerShellValidateOptions, getTypeScriptValidateOptions, NodeModelInput, NodeModelVersion } from './validateProject';

interface CreateProjectTestCase extends ICreateProjectTestOptions {
description?: string;
Expand All @@ -30,9 +30,6 @@ const testCases: CreateProjectTestCase[] = [
{ ...getTypeScriptValidateOptions({ version: FuncVersion.v4, modelVersion: NodeModelVersion.v4 }), inputs: [NodeModelInput[NodeModelVersion.v4]], languageModelVersion: NodeModelVersion.v4 },
// PowerShell tests
{ ...getPowerShellValidateOptions(FuncVersion.v4) },
// Python tests
{ ...getPythonValidateOptions('.venv', FuncVersion.v4), inputs: [PythonModelInput[PythonModelVersion.v1], TestInput.UseDefaultValue], languageModelVersion: PythonModelVersion.v1 },
{ ...getPythonValidateOptions('.venv', FuncVersion.v4, PythonModelVersion.v2), inputs: [PythonModelInput[PythonModelVersion.v2], TestInput.UseDefaultValue], languageModelVersion: PythonModelVersion.v2 },
// Custom language tests
{ ...getCustomValidateOptions(FuncVersion.v4) }
];
Expand Down
16 changes: 8 additions & 8 deletions test/templateCount.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ function addSuite(source: TemplateSource | undefined): void {
suite(`Template Count - ${source === undefined ? 'defaultOnExtensionActivation' : source}`, () => {
const cases: TestCase[] = [
{ language: ProjectLanguage.JavaScript, version: FuncVersion.v1, expectedCount: 8 },
{ language: ProjectLanguage.JavaScript, version: FuncVersion.v4, expectedCount: 17 },
{ language: ProjectLanguage.JavaScript, version: FuncVersion.v4, expectedCount: 18 },
{ language: ProjectLanguage.CSharp, version: FuncVersion.v1, expectedCount: 12 },
{ language: ProjectLanguage.CSharp, version: FuncVersion.v4, expectedCount: 13, projectTemplateKey: 'net6.0' },
{ language: ProjectLanguage.CSharp, version: FuncVersion.v4, expectedCount: 11, projectTemplateKey: 'net6.0-isolated' },
{ language: ProjectLanguage.CSharp, version: FuncVersion.v4, expectedCount: 11, projectTemplateKey: 'net7.0-isolated' },
{ language: ProjectLanguage.CSharp, version: FuncVersion.v4, expectedCount: 11, projectTemplateKey: 'net8.0-isolated' },
{ language: ProjectLanguage.Python, version: FuncVersion.v4, expectedCount: 14 },
{ language: ProjectLanguage.TypeScript, version: FuncVersion.v4, expectedCount: 17 },
{ language: ProjectLanguage.PowerShell, version: FuncVersion.v4, expectedCount: 15 },
{ language: ProjectLanguage.CSharp, version: FuncVersion.v4, expectedCount: 15, projectTemplateKey: 'net6.0' },
{ language: ProjectLanguage.CSharp, version: FuncVersion.v4, expectedCount: 13, projectTemplateKey: 'net6.0-isolated' },
{ language: ProjectLanguage.CSharp, version: FuncVersion.v4, expectedCount: 13, projectTemplateKey: 'net7.0-isolated' },
{ language: ProjectLanguage.CSharp, version: FuncVersion.v4, expectedCount: 13, projectTemplateKey: 'net8.0-isolated' },
{ language: ProjectLanguage.Python, version: FuncVersion.v4, expectedCount: 15 },
{ language: ProjectLanguage.TypeScript, version: FuncVersion.v4, expectedCount: 18 },
{ language: ProjectLanguage.PowerShell, version: FuncVersion.v4, expectedCount: 16 },
{ language: ProjectLanguage.Ballerina, version: FuncVersion.v4, expectedCount: 5 }
];

Expand Down
Loading