Add azure and standalone instance config to environment variables (#4745)

* change to fs to write file

* change random range to 1 to 100

* Added more env variables check as well

* Add azure and standalone env variables

* Add Azure instance to unblock mac pipeline testing

* Fixed some merge issue and improve delete file

* Added standalone test only run on windows
This commit is contained in:
Yurong He
2019-03-29 20:14:44 -07:00
committed by GitHub
parent ddbd8033f9
commit a4c2463b2f
6 changed files with 94 additions and 30 deletions

View File

@@ -8,27 +8,31 @@
import 'mocha';
import * as azdata from 'azdata';
import { context } from './testContext';
import { getDefaultTestingServer, getBdcServer, TestServerProfile } from './testConfig';
import { getBdcServer, TestServerProfile, getAzureServer, getStandaloneServer } from './testConfig';
import { connectToServer } from './utils';
import assert = require('assert');
if (context.RunTest) {
suite('Object Explorer integration suite', () => {
test('BDC instance node label test', async function () {
assert(process.env.BDC_BACKEND_HOSTNAME !== undefined &&
process.env.BDC_BACKEND_USERNAME !== undefined &&
process.env.BDC_BACKEND_PWD !== undefined, 'BDC_BACKEND_HOSTNAME, BDC_BACKEND_USERNAME, BDC_BACKEND_PWD must be set using ./scripts/setbackenvariables.sh or .\\scripts\\setbackendvaraibles.bat');
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects', 'Data Services'];
let server = await getBdcServer();
await VerifyOeNode(server, 6000, expectedNodeLabel);
});
test('Standard alone instance node label test', async function () {
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects'];
let server = await getDefaultTestingServer();
if (process.platform === 'win32') {
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects'];
let server = await getStandaloneServer();
await VerifyOeNode(server, 3000, expectedNodeLabel);
}
});
test('Azure SQL DB instance node label test', async function () {
const expectedNodeLabel = ['Databases', 'Security'];
let server = await getAzureServer();
await VerifyOeNode(server, 3000, expectedNodeLabel);
});
test('context menu test', async function () {
let server = await getDefaultTestingServer();
let server = await getAzureServer();
await connectToServer(server, 3000);
let nodes = <azdata.objectexplorer.ObjectExplorerNode[]>await azdata.objectexplorer.getActiveConnectionNodes();
assert(nodes.length > 0, `Expecting at least one active connection, actual: ${nodes.length}`);
@@ -64,6 +68,6 @@ async function VerifyOeNode(server: TestServerProfile, timeout: number, expected
assert(childeren.length === expectedNodeLable.length, `Expecting node count: ${expectedNodeLable.length}, Actual: ${childeren.length}`);
childeren.forEach(c => actualNodeLable.push(c.label));
assert(expectedNodeLable.toLocaleString() === actualNodeLable.toLocaleString(), `Expected node label: "$'${expectedNodeLable}", Actual: "${actualNodeLable}"`);
assert(expectedNodeLable.toLocaleString() === actualNodeLable.toLocaleString(), `Expected node label: "${expectedNodeLable}", Actual: "${actualNodeLable}"`);
}