Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 (#8911)

* Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2

* update distro

* fix layering

* update distro

* fix tests
This commit is contained in:
Anthony Dresser
2020-01-22 13:42:37 -08:00
committed by GitHub
parent 977111eb21
commit bd7aac8ee0
895 changed files with 24651 additions and 14520 deletions

View File

@@ -14,6 +14,7 @@ import * as vscode from 'vscode';
import { isTestSetupCompleted } from './testContext';
import { getStandaloneServer } from './testConfig';
import * as assert from 'assert';
import { promisify } from 'util';
const retryCount = 24; // 2 minutes
const dacpac1: string = path.join(__dirname, '../testData/Database1.dacpac');
@@ -56,8 +57,8 @@ if (isTestSetupCompleted()) {
// Extract dacpac
const folderPath = path.join(os.tmpdir(), 'DacFxTest');
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
if (!(await promisify(fs.exists)(folderPath))) {
await fs.promises.mkdir(folderPath);
}
const packageFilePath = path.join(folderPath, `${databaseName}.dacpac`);
const extractResult = await dacfxService.extractDacpac(databaseName, packageFilePath, databaseName, '1.0.0.0', ownerUri, azdata.TaskExecutionMode.execute);
@@ -102,8 +103,8 @@ if (isTestSetupCompleted()) {
// Export bacpac
const folderPath = path.join(os.tmpdir(), 'DacFxTest');
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
if (!(await promisify(fs.exists)(folderPath))) {
await fs.promises.mkdir(folderPath);
}
const packageFilePath = path.join(folderPath, `${databaseName}.bacpac`);
const exportResult = await dacfxService.exportBacpac(databaseName, packageFilePath, ownerUri, azdata.TaskExecutionMode.execute);

View File

@@ -19,6 +19,7 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand('test.setupIntegrationTest', async () => {
let extensionInstallersFolder = normalize(join(__dirname, '../extensionInstallers'));
console.info(`extensionInstallersFolder=${extensionInstallersFolder}`);
// eslint-disable-next-line no-sync
let installers = fs.readdirSync(extensionInstallersFolder);
for (let i = 0; i < installers.length; i++) {
if (installers[i].endsWith('.vsix')) {

View File

@@ -13,7 +13,7 @@ import { getConfigValue, EnvironmentVariable_PYTHON_PATH, TestServerProfile, get
import { connectToServer, sleep, testServerProfileToIConnectionProfile } from './utils';
import * as fs from 'fs';
import { stressify } from 'adstest';
import { isNullOrUndefined } from 'util';
import { isNullOrUndefined, promisify } from 'util';
if (isTestSetupCompleted()) {
suite('Notebook integration test suite', function () {
@@ -375,8 +375,8 @@ class NotebookTester {
async cleanup(testName: string): Promise<void> {
try {
let fileName = getFileName(testName + this.invocationCount++);
if (fs.existsSync(fileName)) {
fs.unlinkSync(fileName);
if (await promisify(fs.exists)(fileName)) {
await fs.promises.unlink(fileName);
console.log(`"${fileName}" is deleted.`);
}
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');

View File

@@ -164,6 +164,7 @@ export const pythonKernelSpec: azdata.nb.IKernelSpec = {
export function writeNotebookToFile(pythonNotebook: azdata.nb.INotebookContents, testName: string): vscode.Uri {
let fileName = getFileName(testName);
let notebookContentString = JSON.stringify(pythonNotebook);
// eslint-disable-next-line no-sync
fs.writeFileSync(fileName, notebookContentString);
console.log(`Local file is created: '${fileName}'`);
let uri = vscode.Uri.file(fileName);

View File

@@ -15,6 +15,7 @@ import { isTestSetupCompleted } from './testContext';
import * as assert from 'assert';
import { getStandaloneServer } from './testConfig';
import { stressify } from 'adstest';
import { promisify } from 'util';
let schemaCompareService: mssql.ISchemaCompareService;
let dacfxService: mssql.IDacFxService;
@@ -91,12 +92,12 @@ class SchemaCompareTester {
// save to scmp
const filepath = path.join(folderPath, `ads_schemaCompare_${now.getTime().toString()}.scmp`);
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
if (!(await promisify(fs.exists)(folderPath))) {
await fs.promises.mkdir(folderPath);
}
const saveScmpResult = await schemaCompareService.schemaCompareSaveScmp(source, target, azdata.TaskExecutionMode.execute, null, filepath, [], []);
assert(saveScmpResult.success && !saveScmpResult.errorMessage, `Save scmp should succeed. Expected: there should be no error. Actual Error message: "${saveScmpResult.errorMessage}`);
assert(fs.existsSync(filepath), `File ${filepath} is expected to be present`);
assert(await promisify(fs.exists)(filepath), `File ${filepath} is expected to be present`);
// open scmp
const openScmpResult = await schemaCompareService.schemaCompareOpenScmp(filepath);
@@ -165,12 +166,12 @@ class SchemaCompareTester {
// save to scmp
const filepath = path.join(folderPath, `ads_schemaCompare_${now.getTime().toString()}.scmp`);
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
if (!(await promisify(fs.exists)(folderPath))) {
await fs.promises.mkdir(folderPath);
}
const saveScmpResult = await schemaCompareService.schemaCompareSaveScmp(source, target, azdata.TaskExecutionMode.execute, null, filepath, [], []);
assert(saveScmpResult.success && !saveScmpResult.errorMessage, `Save scmp should succeed. Expected: there should be no error. Actual Error message: "${saveScmpResult.errorMessage}`);
assert(fs.existsSync(filepath), `File ${filepath} is expected to be present`);
assert(promisify(fs.exists)(filepath), `File ${filepath} is expected to be present`);
// open scmp
const openScmpResult = await schemaCompareService.schemaCompareOpenScmp(filepath);
@@ -178,7 +179,7 @@ class SchemaCompareTester {
assert(openScmpResult.sourceEndpointInfo.databaseName === source.databaseName, `Expected: source database to be ${source.databaseName}, Actual: ${openScmpResult.sourceEndpointInfo.databaseName}`);
assert(openScmpResult.targetEndpointInfo.databaseName === target.databaseName, `Expected: target database to be ${target.databaseName}, Actual: ${openScmpResult.targetEndpointInfo.databaseName}`);
fs.unlinkSync(filepath);
await fs.promises.unlink(filepath);
}
finally {
await utils.deleteDB(server, sourceDB, ownerUri);
@@ -237,12 +238,12 @@ class SchemaCompareTester {
// save to scmp
const filepath = path.join(folderPath, `ads_schemaCompare_${now.getTime().toString()}.scmp`);
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
if (!(await promisify(fs.exists)(folderPath))) {
await fs.promises.mkdir(folderPath);
}
const saveScmpResult = await schemaCompareService.schemaCompareSaveScmp(source, target, azdata.TaskExecutionMode.execute, null, filepath, [], []);
assert(saveScmpResult.success && !saveScmpResult.errorMessage, `Save scmp should succeed. Expected: there should be no error. Actual Error message: "${saveScmpResult.errorMessage}`);
assert(fs.existsSync(filepath), `File ${filepath} is expected to be present`);
assert(await promisify(fs.exists)(filepath), `File ${filepath} is expected to be present`);
// open scmp
const openScmpResult = await schemaCompareService.schemaCompareOpenScmp(filepath);

View File

@@ -8,7 +8,7 @@ import * as azdata from 'azdata';
import * as vscode from 'vscode';
import * as fs from 'fs';
import { TestServerProfile, TestConnectionInfo } from './testConfig';
import { isNullOrUndefined } from 'util';
import { isNullOrUndefined, promisify } from 'util';
// default server connection timeout
export const DefaultConnectTimeoutInMs: number = 10000;
@@ -217,13 +217,13 @@ export async function assertFileGenerationResult(filepath: string, retryCount: n
let exists = false;
while (retryCount > 0 && !exists) {
--retryCount;
exists = fs.existsSync(filepath);
exists = await promisify(fs.exists)(filepath);
await sleep(5000);
}
assert(exists, `File ${filepath} is expected to be present`);
assert(fs.readFileSync(filepath).byteLength > 0, 'File ${filepath} should not be empty');
fs.unlinkSync(filepath);
assert((await fs.promises.readFile(filepath)).byteLength > 0, 'File ${filepath} should not be empty');
await fs.promises.unlink(filepath);
}
/**