Adds SQL Binding Create Azure Function with SQL Binding tests (#19538)

* add a couple of azure function service tests

* address comments

* use mock for azureFunctionExtensionAPI
This commit is contained in:
Vasu Bhog
2022-05-31 21:04:39 -04:00
committed by GitHub
parent aeb1e776d4
commit 6c7a8313b2
6 changed files with 420 additions and 177 deletions

View File

@@ -63,7 +63,7 @@ export async function createAzureFunction(node?: ITreeNodeInfo): Promise<void> {
isCreateNewProject = true;
telemetryStep = CreateAzureFunctionStep.getSelectedFolder;
// user either has not folder open or an empty workspace
// user either has no folder open or an empty workspace
// prompt user to choose a folder to create the project in
const browseProjectLocation = await vscode.window.showQuickPick(
[constants.browseEllipsisWithIcon],
@@ -190,6 +190,7 @@ export async function createAzureFunction(node?: ITreeNodeInfo): Promise<void> {
// prompt for Connection String Setting Name
let connectionStringInfo: IConnectionStringInfo | undefined = { connectionStringSettingName: constants.sqlConnectionStringSetting, connectionInfo: connectionInfo };
if (!isCreateNewProject && projectFile) {
// if it is not a new project, we can prompt user for connection string setting name and connection string password prompts
telemetryStep = CreateAzureFunctionStep.getConnectionStringSettingName;
connectionStringInfo = await azureFunctionsUtils.promptAndUpdateConnectionStringSetting(vscode.Uri.parse(projectFile), connectionInfo);
if (!connectionStringInfo) {
@@ -227,7 +228,6 @@ export async function createAzureFunction(node?: ITreeNodeInfo): Promise<void> {
// check for the new function file to be created and dispose of the file system watcher
const timeoutForFunctionFile = utils.timeoutPromise(constants.timeoutAzureFunctionFileError);
await Promise.race([newFunctionFileObject.filePromise, timeoutForFunctionFile]);
telemetryStep = 'finishCreateFunction';
propertyBag.telemetryStep = telemetryStep;
exitReason = ExitReason.finishCreate;
@@ -254,9 +254,7 @@ export async function createAzureFunction(node?: ITreeNodeInfo): Promise<void> {
propertyBag.exitReason = exitReason;
TelemetryReporter.createActionEvent(TelemetryViews.CreateAzureFunctionWithSqlBinding, TelemetryActions.exitCreateAzureFunctionQuickpick)
.withAdditionalProperties(propertyBag).send();
if (newFunctionFileObject) {
newFunctionFileObject.watcherDisposable.dispose();
}
newFunctionFileObject?.watcherDisposable.dispose();
}
}