Remove checks for integration testing (#9856)

* remove checks for testing

* fix schema compare tests

* move some files

* fix file location

* fixc another file path
This commit is contained in:
Anthony Dresser
2020-04-07 14:50:20 -07:00
committed by GitHub
parent d580c13be1
commit f056086662
13 changed files with 378 additions and 551 deletions

View File

@@ -1,57 +0,0 @@
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const fs = require('fs').promises;
const path = require('path');
const readConfiguration = (async () => {
const parseConfigString = ((content) => {
try {
const result = JSON.parse(content);
return result;
}
catch (ex) {
console.log('Could NOT parse TEST_RUN_LIST:', content);
}
});
// Attempt to read from an enviornment variable
const testRunlist = process.env['TEST_RUN_LIST'];
if (testRunlist && testRunlist !== '') {
const result = parseConfigString(testRunlist);
if (result) {
console.log('Using the environment test run list:', result);
return result;
}
}
// Attempt to read from a config file
let testRunPath = process.env['TEST_RUN_LIST_FILE'];
if (!testRunPath || testRunPath === '') {
testRunPath = path.resolve(__dirname, '..', 'runlist.json');
}
try {
const contents = await fs.readFile(testRunPath);
return parseConfigString(contents);
}
catch (ex) {
console.log(`error reading file ${testRunPath}:`, ex);
}
});
(async () => {
const keys = process.argv.slice(2);
const configuration = await readConfiguration();
if (!configuration) {
console.log('no configuration was setup');
return;
}
const testList = [];
keys.forEach((key) => {
const arr = configuration[key];
if (arr) {
testList.push(...arr);
}
});
const result = `(${testList.join('|')})`;
console.log(result);
process.env['TEST_GREP'] = result;
})();

View File

@@ -1,67 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const fs = require('fs').promises;
const path = require('path');
interface IntegrationTestConfig {
[key: string]: string[];
}
const readConfiguration = (async (): Promise<IntegrationTestConfig | void> => {
const parseConfigString = ((content: string): (IntegrationTestConfig | void) => {
try {
const result = JSON.parse(content);
return result as IntegrationTestConfig;
} catch (ex) {
console.log('Could NOT parse TEST_RUN_LIST:', content);
}
});
// Attempt to read from an enviornment variable
const testRunlist = process.env['TEST_RUN_LIST'];
if (testRunlist && testRunlist !== '') {
const result = parseConfigString(testRunlist);
if (result) {
console.log('Using the environment test run list:', result);
return result;
}
}
// Attempt to read from a config file
let testRunPath = process.env['TEST_RUN_LIST_FILE'];
if (!testRunPath || testRunPath === '') {
testRunPath = path.resolve(__dirname, '..', 'runlist.json');
}
try {
const contents = await fs.readFile(testRunPath);
return parseConfigString(contents);
} catch (ex) {
console.log(`error reading file ${testRunPath}:`, ex);
}
});
(async (): Promise<string | void> => {
const keys = process.argv.slice(2);
const configuration = await readConfiguration();
if (!configuration) {
console.log('no configuration was setup');
return;
}
const testList: string[] = [];
keys.forEach((key) => {
const arr = configuration[key];
if (arr) {
testList.push(...arr);
}
});
const result = `(${testList.join('|')})`;
console.log(result);
process.env['TEST_GREP'] = result;
})();

View File

@@ -21,31 +21,6 @@
"Microsoft.notebook", "Microsoft.notebook",
"Microsoft.azuredatastudio-postgresql" "Microsoft.azuredatastudio-postgresql"
], ],
"contributes": {
"configuration": {
"type": "object",
"title": "ADS Integration Test Configuration",
"properties": {
"test.testSetupCompleted": {
"type": "boolean",
"default": false,
"description": ""
}
}
},
"commands": [
{
"command": "test.setupIntegrationTest",
"title": "Setup Integration Test",
"category": "Test"
},
{
"command": "test.waitForExtensionsToLoad",
"title": "Wait For Extensions To Load",
"category": "Test"
}
]
},
"scripts": { "scripts": {
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json", "vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:vscode-colorize-tests ./tsconfig.json",
"postinstall": "node ./node_modules/vscode/bin/install" "postinstall": "node ./node_modules/vscode/bin/install"

View File

@@ -1,10 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
export function isTestSetupCompleted(): boolean {
return vscode.workspace.getConfiguration('test')['testSetupCompleted'];
}

View File

@@ -7,11 +7,10 @@ import 'mocha';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as mssql from '../../../mssql'; import * as mssql from '../../../mssql';
import * as utils from '../utils'; import * as utils from './utils';
import * as uuid from '../uuid'; import * as uuid from './uuid';
import { isTestSetupCompleted } from '../testContext';
import assert = require('assert'); import assert = require('assert');
import { getStandaloneServer, TestServerProfile } from '../testConfig'; import { getStandaloneServer, TestServerProfile } from './testConfig';
let cmsService: mssql.ICmsService; let cmsService: mssql.ICmsService;
let server: TestServerProfile; let server: TestServerProfile;
@@ -23,8 +22,7 @@ const TEST_CMS_GROUP = `adsTestCmsGroup_${uuid.v4().asHex()}`;
const TEST_CMS_SERVER = `adsTestCmsServer_${uuid.v4().asHex()}`; const TEST_CMS_SERVER = `adsTestCmsServer_${uuid.v4().asHex()}`;
const TEST_CMS_REG_SERVER = `adsTestCmsRegisteredServer_${uuid.v4().asHex()}`; const TEST_CMS_REG_SERVER = `adsTestCmsRegisteredServer_${uuid.v4().asHex()}`;
if (isTestSetupCompleted()) { suite('CMS integration test suite', () => {
suite('CMS integration test suite', () => {
setup(async function () { setup(async function () {
// Set up CMS provider // Set up CMS provider
@@ -161,5 +159,4 @@ if (isTestSetupCompleted()) {
let deleteResult = await cmsService.removeServerGroup(ownerUri, '', TEST_CMS_GROUP); let deleteResult = await cmsService.removeServerGroup(ownerUri, '', TEST_CMS_GROUP);
assert(deleteResult === true, `Server group ${TEST_CMS_GROUP} was not deleted from CMS server successfully`); assert(deleteResult === true, `Server group ${TEST_CMS_GROUP} was not deleted from CMS server successfully`);
}); });
}); });
}

View File

@@ -5,21 +5,19 @@
import 'mocha'; import 'mocha';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as utils from '../utils'; import * as utils from './utils';
import * as path from 'path'; import * as path from 'path';
import * as fs from 'fs'; import * as fs from 'fs';
import * as os from 'os'; import * as os from 'os';
import * as mssql from '../../../mssql'; import * as mssql from '../../../mssql';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { isTestSetupCompleted } from '../testContext'; import { getStandaloneServer } from './testConfig';
import { getStandaloneServer } from '../testConfig';
import * as assert from 'assert'; import * as assert from 'assert';
import { promisify } from 'util'; import { promisify } from 'util';
const retryCount = 24; // 2 minutes const retryCount = 24; // 2 minutes
const dacpac1: string = path.join(__dirname, '../testData/Database1.dacpac'); const dacpac1: string = path.join(__dirname, '../../testData/Database1.dacpac');
if (isTestSetupCompleted()) { suite('Dacpac integration test suite', () => {
suite('Dacpac integration test suite', () => {
suiteSetup(async function () { suiteSetup(async function () {
await utils.sleep(5000); // To ensure the providers are registered. await utils.sleep(5000); // To ensure the providers are registered.
console.log(`Start dacpac tests`); console.log(`Start dacpac tests`);
@@ -70,7 +68,7 @@ if (isTestSetupCompleted()) {
} }
}); });
const bacpac1: string = path.join(__dirname, '..', 'testData', 'Database1.bacpac'); const bacpac1: string = path.join(__dirname, '..', '..', 'testData', 'Database1.bacpac');
test('Import and export bacpac', async function () { test('Import and export bacpac', async function () {
const server = await getStandaloneServer(); const server = await getStandaloneServer();
await utils.connectToServer(server); await utils.connectToServer(server);
@@ -114,5 +112,4 @@ if (isTestSetupCompleted()) {
await utils.deleteDB(server, databaseName, ownerUri); await utils.deleteDB(server, databaseName, ownerUri);
} }
}); });
}); });
}

View File

@@ -7,22 +7,21 @@ import 'mocha';
import * as assert from 'assert'; import * as assert from 'assert';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { isTestSetupCompleted } from '../testContext'; import { sqlNotebookContent, writeNotebookToFile, sqlKernelMetadata, getFileName, pySparkNotebookContent, pySparkKernelMetadata, pythonKernelMetadata, sqlNotebookMultipleCellsContent, notebookContentForCellLanguageTest, sqlKernelSpec, pythonKernelSpec, pySparkKernelSpec, CellTypes } from './notebook.util';
import { sqlNotebookContent, writeNotebookToFile, sqlKernelMetadata, getFileName, pySparkNotebookContent, pySparkKernelMetadata, pythonKernelMetadata, sqlNotebookMultipleCellsContent, notebookContentForCellLanguageTest, sqlKernelSpec, pythonKernelSpec, pySparkKernelSpec, CellTypes } from '../notebook.util'; import { getConfigValue, EnvironmentVariable_PYTHON_PATH, TestServerProfile, getStandaloneServer } from './testConfig';
import { getConfigValue, EnvironmentVariable_PYTHON_PATH, TestServerProfile, getStandaloneServer } from '../testConfig'; import { connectToServer, sleep, testServerProfileToIConnectionProfile } from './utils';
import { connectToServer, sleep, testServerProfileToIConnectionProfile } from '../utils';
import * as fs from 'fs'; import * as fs from 'fs';
import { stressify } from 'adstest'; import { stressify } from 'adstest';
import { isNullOrUndefined, promisify } from 'util'; import { isNullOrUndefined, promisify } from 'util';
if (isTestSetupCompleted()) { suite('Notebook integration test suite', function () {
suite('Notebook integration test suite', function () {
setup(async function () { setup(async function () {
console.log(`Start "${this.currentTest.title}"`); console.log(`Start "${this.currentTest.title}"`);
let server = await getStandaloneServer(); let server = await getStandaloneServer();
assert(server && server.serverName, 'No server could be found'); assert(server && server.serverName, 'No server could be found');
await connectToServer(server, 6000); await connectToServer(server, 6000);
}); });
teardown(async function () { teardown(async function () {
await (new NotebookTester()).cleanup(this.currentTest.title); await (new NotebookTester()).cleanup(this.currentTest.title);
}); });
@@ -101,8 +100,7 @@ if (isTestSetupCompleted()) {
await (new NotebookTester()).cplusplusLanguageTest(this.test.title); await (new NotebookTester()).cplusplusLanguageTest(this.test.title);
}); });
*/ */
}); });
}
class NotebookTester { class NotebookTester {
private static ParallelCount = 1; private static ParallelCount = 1;

View File

@@ -5,14 +5,12 @@
import 'mocha'; import 'mocha';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import { isTestSetupCompleted } from '../testContext'; import { getBdcServer, TestServerProfile, getAzureServer, getStandaloneServer } from './testConfig';
import { getBdcServer, TestServerProfile, getAzureServer, getStandaloneServer } from '../testConfig'; import { connectToServer, createDB, deleteDB, DefaultConnectTimeoutInMs, asyncTimeout } from './utils';
import { connectToServer, createDB, deleteDB, DefaultConnectTimeoutInMs, asyncTimeout } from '../utils';
import * as assert from 'assert'; import * as assert from 'assert';
import { stressify } from 'adstest'; import { stressify } from 'adstest';
if (isTestSetupCompleted()) { suite('Object Explorer integration suite', () => {
suite('Object Explorer integration suite', () => {
test.skip('BDC instance node label test', async function () { test.skip('BDC instance node label test', async function () {
return await (new ObjectExplorerTester()).bdcNodeLabelTest(); return await (new ObjectExplorerTester()).bdcNodeLabelTest();
}); });
@@ -31,8 +29,7 @@ if (isTestSetupCompleted()) {
test('Standalone database context menu test', async function () { test('Standalone database context menu test', async function () {
return await (new ObjectExplorerTester()).standaloneContextMenuTest(); return await (new ObjectExplorerTester()).standaloneContextMenuTest();
}); });
}); });
}
class ObjectExplorerTester { class ObjectExplorerTester {
private static ParallelCount = 1; private static ParallelCount = 1;

View File

@@ -6,30 +6,28 @@
import 'mocha'; import 'mocha';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as utils from '../utils'; import * as utils from './utils';
import * as mssql from '../../../mssql'; import * as mssql from '../../../mssql';
import * as os from 'os'; import * as os from 'os';
import * as fs from 'fs'; import * as fs from 'fs';
const path = require('path'); const path = require('path');
import { isTestSetupCompleted } from '../testContext';
import * as assert from 'assert'; import * as assert from 'assert';
import { getStandaloneServer } from '../testConfig'; import { getStandaloneServer } from './testConfig';
import { stressify } from 'adstest'; import { stressify } from 'adstest';
import { promisify } from 'util'; import { promisify } from 'util';
let schemaCompareService: mssql.ISchemaCompareService; let schemaCompareService: mssql.ISchemaCompareService;
let dacfxService: mssql.IDacFxService; let dacfxService: mssql.IDacFxService;
let schemaCompareTester: SchemaCompareTester; let schemaCompareTester: SchemaCompareTester;
const dacpac1: string = path.join(__dirname, '..','testData', 'Database1.dacpac'); const dacpac1: string = path.join(__dirname, '..', '..', 'testData', 'Database1.dacpac');
const dacpac2: string = path.join(__dirname, '..', 'testData', 'Database2.dacpac'); const dacpac2: string = path.join(__dirname, '..', '..', 'testData', 'Database2.dacpac');
const includeExcludeSourceDacpac: string = path.join(__dirname, '..', 'testData', 'SchemaCompareIncludeExcludeSource.dacpac'); const includeExcludeSourceDacpac: string = path.join(__dirname, '..', '..', 'testData', 'SchemaCompareIncludeExcludeSource.dacpac');
const includeExcludeTargetDacpac: string = path.join(__dirname, '..', 'testData', 'SchemaCompareIncludeExcludeTarget.dacpac'); const includeExcludeTargetDacpac: string = path.join(__dirname, '..', '..', 'testData', 'SchemaCompareIncludeExcludeTarget.dacpac');
const SERVER_CONNECTION_TIMEOUT: number = 3000; const SERVER_CONNECTION_TIMEOUT: number = 3000;
const retryCount = 24; // 2 minutes const retryCount = 24; // 2 minutes
const folderPath = path.join(os.tmpdir(), 'SchemaCompareTest'); const folderPath = path.join(os.tmpdir(), 'SchemaCompareTest');
if (isTestSetupCompleted()) { suite('Schema compare integration test suite', () => {
suite('Schema compare integration test suite', () => {
suiteSetup(async function () { suiteSetup(async function () {
let attempts: number = 20; let attempts: number = 20;
while (attempts > 0) { while (attempts > 0) {
@@ -56,8 +54,7 @@ if (isTestSetupCompleted()) {
test('Schema compare dacpac to dacpac comparison with include exclude', async function () { test('Schema compare dacpac to dacpac comparison with include exclude', async function () {
await schemaCompareTester.SchemaCompareIncludeExcludeDacpacToDacpac(); await schemaCompareTester.SchemaCompareIncludeExcludeDacpacToDacpac();
}); });
}); });
}
class SchemaCompareTester { class SchemaCompareTester {
private static ParallelCount = 1; private static ParallelCount = 1;