check setting directly to avoid value reset (#8583)

This commit is contained in:
Alan Ren
2019-12-05 15:57:13 -08:00
committed by GitHub
parent 0bf4790a64
commit 3de95af25c
8 changed files with 17 additions and 24 deletions

View File

@@ -9,7 +9,7 @@ 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 { context } from './testContext'; import { isTestSetupCompleted } from './testContext';
import assert = require('assert'); import assert = require('assert');
import { getStandaloneServer, TestServerProfile, getBdcServer } from './testConfig'; import { getStandaloneServer, TestServerProfile, getBdcServer } from './testConfig';
@@ -23,7 +23,7 @@ const TEST_CMS_GROUP = `adsTestCmsGroup_${uuid.v4()}`;
const TEST_CMS_SERVER = `adsTestCmsServer_${uuid.v4()}`; const TEST_CMS_SERVER = `adsTestCmsServer_${uuid.v4()}`;
const TEST_CMS_REG_SERVER = `adsTestCmsRegisteredServer_${uuid.v4()}`; const TEST_CMS_REG_SERVER = `adsTestCmsRegisteredServer_${uuid.v4()}`;
if (context.RunTest) { if (isTestSetupCompleted()) {
suite('CMS integration test suite', () => { suite('CMS integration test suite', () => {
setup(async function () { setup(async function () {

View File

@@ -11,13 +11,13 @@ 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 { context } from './testContext'; import { isTestSetupCompleted } from './testContext';
import { getStandaloneServer } from './testConfig'; import { getStandaloneServer } from './testConfig';
import * as assert from 'assert'; import * as assert from 'assert';
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 (context.RunTest) { 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.

View File

@@ -4,12 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import * as testRunner from 'vscode/lib/testrunner'; import * as testRunner from 'vscode/lib/testrunner';
import * as vscode from 'vscode';
import { SuiteType, getSuiteType } from 'adstest'; import { SuiteType, getSuiteType } from 'adstest';
import { context } from './testContext';
import * as path from 'path'; import * as path from 'path';
const suite = getSuiteType(); const suite = getSuiteType();
@@ -62,10 +57,6 @@ if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
}; };
} }
if (!vscode.workspace.getConfiguration('test')['testSetupCompleted']) {
context.RunTest = false;
}
testRunner.configure(options); testRunner.configure(options);
export = testRunner; export = testRunner;

View File

@@ -7,7 +7,7 @@ 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 { context } from './testContext'; 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 { getBdcServer, getConfigValue, EnvironmentVariable_PYTHON_PATH } from './testConfig'; import { getBdcServer, getConfigValue, EnvironmentVariable_PYTHON_PATH } from './testConfig';
import { connectToServer, sleep } from './utils'; import { connectToServer, sleep } from './utils';
@@ -15,7 +15,7 @@ import * as fs from 'fs';
import { stressify } from 'adstest'; import { stressify } from 'adstest';
import { isNullOrUndefined } from 'util'; import { isNullOrUndefined } from 'util';
if (context.RunTest) { 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}"`);

View File

@@ -5,13 +5,13 @@
import 'mocha'; import 'mocha';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import { context } from './testContext'; 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 (context.RunTest) { if (isTestSetupCompleted()) {
suite('Object Explorer integration suite', () => { suite('Object Explorer integration suite', () => {
test('BDC instance node label test', async function () { test('BDC instance node label test', async function () {
return await (new ObjectExplorerTester()).bdcNodeLabelTest(); return await (new ObjectExplorerTester()).bdcNodeLabelTest();

View File

@@ -11,7 +11,7 @@ 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 { context } from './testContext'; 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';
@@ -25,7 +25,7 @@ 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 (context.RunTest) { 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;

View File

@@ -5,7 +5,7 @@
import 'mocha'; import 'mocha';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { context } from './testContext'; import { isTestSetupCompleted } from './testContext';
import * as assert from 'assert'; import * as assert from 'assert';
import { getConfigValue, EnvironmentVariable_BDC_SERVER, EnvironmentVariable_BDC_USERNAME, EnvironmentVariable_BDC_PASSWORD, EnvironmentVariable_AZURE_PASSWORD, EnvironmentVariable_AZURE_SERVER, EnvironmentVariable_AZURE_USERNAME, EnvironmentVariable_STANDALONE_PASSWORD, EnvironmentVariable_STANDALONE_SERVER, EnvironmentVariable_STANDALONE_USERNAME, EnvironmentVariable_PYTHON_PATH } from './testConfig'; import { getConfigValue, EnvironmentVariable_BDC_SERVER, EnvironmentVariable_BDC_USERNAME, EnvironmentVariable_BDC_PASSWORD, EnvironmentVariable_AZURE_PASSWORD, EnvironmentVariable_AZURE_SERVER, EnvironmentVariable_AZURE_USERNAME, EnvironmentVariable_STANDALONE_PASSWORD, EnvironmentVariable_STANDALONE_SERVER, EnvironmentVariable_STANDALONE_USERNAME, EnvironmentVariable_PYTHON_PATH } from './testConfig';
@@ -20,7 +20,7 @@ assert(getConfigValue(EnvironmentVariable_BDC_SERVER) !== undefined &&
getConfigValue(EnvironmentVariable_STANDALONE_USERNAME) !== undefined && getConfigValue(EnvironmentVariable_STANDALONE_USERNAME) !== undefined &&
getConfigValue(EnvironmentVariable_PYTHON_PATH) !== undefined, 'Required environment variables are not set, if you see this error in the build pipeline, make sure the environment variables are set properly in the build definition, otherwise for local dev environment make sure you follow the instructions in the readme file.'); getConfigValue(EnvironmentVariable_PYTHON_PATH) !== undefined, 'Required environment variables are not set, if you see this error in the build pipeline, make sure the environment variables are set properly in the build definition, otherwise for local dev environment make sure you follow the instructions in the readme file.');
if (!context.RunTest) { if (!isTestSetupCompleted()) {
suite('integration test setup', () => { suite('integration test setup', () => {
test('test setup', async function () { test('test setup', async function () {
this.timeout(5 * 60 * 1000); this.timeout(5 * 60 * 1000);

View File

@@ -3,6 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
export let context = { import * as vscode from 'vscode';
RunTest: true
}; export function isTestSetupCompleted(): boolean {
return vscode.workspace.getConfiguration('test')['testSetupCompleted'];
}