Read publish profile using DacFX (#16110)

* Read publish profile using DacFX in VS Code

* Fixes

* complete promise on hide

* comment
This commit is contained in:
Charles Gagnon
2021-07-15 08:53:43 -07:00
committed by GitHub
parent 06da33bb3b
commit d03fbbc066
9 changed files with 126 additions and 82 deletions

View File

@@ -15,6 +15,7 @@ import * as templates from '../templates/templates';
import * as testUtils from './testUtils';
import * as constants from '../common/constants';
import * as mssql from '../../../mssql';
import * as utils from '../common/utils';
import { SqlDatabaseProjectTreeViewProvider } from '../controllers/databaseProjectTreeViewProvider';
import { ProjectsController } from '../controllers/projectController';
@@ -23,7 +24,6 @@ import { createContext, TestContext, mockDacFxResult, mockConnectionProfile } fr
import { Project, reservedProjectFolders, SystemDatabase, FileProjectEntry, SystemDatabaseReferenceProjectEntry } from '../models/project';
import { PublishDatabaseDialog } from '../dialogs/publishDatabaseDialog';
import { IPublishSettings, IGenerateScriptSettings } from '../models/IPublishSettings';
import { exists } from '../common/utils';
import { ProjectRootTreeItem } from '../models/tree/projectTreeItem';
import { FolderNode, FileNode } from '../models/tree/fileFolderTreeItem';
import { BaseProjectTreeItem } from '../models/tree/baseTreeItem';
@@ -198,10 +198,10 @@ describe('ProjectsController', function (): void {
should(proj.postDeployScripts.length).equal(0);
should(proj.noneDeployScripts.length).equal(0);
should(await exists(scriptEntry.fsUri.fsPath)).equal(false, 'script is supposed to be deleted');
should(await exists(preDeployEntry.fsUri.fsPath)).equal(false, 'pre-deployment script is supposed to be deleted');
should(await exists(postDeployEntry.fsUri.fsPath)).equal(false, 'post-deployment script is supposed to be deleted');
should(await exists(noneEntry.fsUri.fsPath)).equal(false, 'none entry pre-deployment script is supposed to be deleted');
should(await utils.exists(scriptEntry.fsUri.fsPath)).equal(false, 'script is supposed to be deleted');
should(await utils.exists(preDeployEntry.fsUri.fsPath)).equal(false, 'pre-deployment script is supposed to be deleted');
should(await utils.exists(postDeployEntry.fsUri.fsPath)).equal(false, 'post-deployment script is supposed to be deleted');
should(await utils.exists(noneEntry.fsUri.fsPath)).equal(false, 'none entry pre-deployment script is supposed to be deleted');
});
it('Should delete database references', async function (): Promise<void> {
@@ -259,10 +259,10 @@ describe('ProjectsController', function (): void {
should(proj.postDeployScripts.length).equal(0);
should(proj.noneDeployScripts.length).equal(0);
should(await exists(scriptEntry.fsUri.fsPath)).equal(true, 'script is supposed to still exist on disk');
should(await exists(preDeployEntry.fsUri.fsPath)).equal(true, 'pre-deployment script is supposed to still exist on disk');
should(await exists(postDeployEntry.fsUri.fsPath)).equal(true, 'post-deployment script is supposed to still exist on disk');
should(await exists(noneEntry.fsUri.fsPath)).equal(true, 'none entry pre-deployment script is supposed to still exist on disk');
should(await utils.exists(scriptEntry.fsUri.fsPath)).equal(true, 'script is supposed to still exist on disk');
should(await utils.exists(preDeployEntry.fsUri.fsPath)).equal(true, 'pre-deployment script is supposed to still exist on disk');
should(await utils.exists(postDeployEntry.fsUri.fsPath)).equal(true, 'post-deployment script is supposed to still exist on disk');
should(await utils.exists(noneEntry.fsUri.fsPath)).equal(true, 'none entry pre-deployment script is supposed to still exist on disk');
});
it('Should delete folders with excluded items', async function (): Promise<void> {
@@ -287,9 +287,9 @@ describe('ProjectsController', function (): void {
// Confirm result
should(proj.files.some(x => x.relativePath === 'UpperFolder')).equal(false, 'UpperFolder should not be part of proj file any more');
should(await exists(scriptEntry.fsUri.fsPath)).equal(false, 'script is supposed to be deleted from disk');
should(await exists(lowerFolder.projectUri.fsPath)).equal(false, 'LowerFolder is supposed to be deleted from disk');
should(await exists(upperFolder.projectUri.fsPath)).equal(false, 'UpperFolder is supposed to be deleted from disk');
should(await utils.exists(scriptEntry.fsUri.fsPath)).equal(false, 'script is supposed to be deleted from disk');
should(await utils.exists(lowerFolder.projectUri.fsPath)).equal(false, 'LowerFolder is supposed to be deleted from disk');
should(await utils.exists(upperFolder.projectUri.fsPath)).equal(false, 'UpperFolder is supposed to be deleted from disk');
});
it('Should reload correctly after changing sqlproj file', async function (): Promise<void> {
@@ -426,8 +426,7 @@ describe('ProjectsController', function (): void {
builtDacpacPath = await testUtils.createTestFile(fakeDacpacContents, 'output.dacpac');
return builtDacpacPath;
});
projController.setup(x => x.getDaxFxService()).returns(() => Promise.resolve(testContext.dacFxService.object));
sinon.stub(utils, 'getDacFxService').resolves(testContext.dacFxService.object);
const proj = await testUtils.createTestProject(baselines.openProjectFileBaseline);