mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
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:
@@ -17,24 +17,25 @@ import { connectToServer } from './utils';
|
||||
import * as fs from 'fs';
|
||||
|
||||
if (context.RunTest) {
|
||||
suite('Notebook integration test suite', () => {
|
||||
suite('Notebook integration test suite', function() {
|
||||
test('Sql NB test', async function () {
|
||||
console.log('Start Sql NB test');
|
||||
let testName = this.test.title;
|
||||
console.log(`Start "${testName}"`);
|
||||
let notebook = await openNotebook(sqlNotebookContent, sqlKernelMetadata);
|
||||
|
||||
const expectedOutput0 = '(1 row affected)';
|
||||
let cellOutputs = notebook.document.cells[0].contents.outputs;
|
||||
console.log('Got cell outputs');
|
||||
assert(cellOutputs.length === 3, `Expected length: 3, Acutal: '${cellOutputs.length}'`);
|
||||
assert(cellOutputs.length === 3, `Expected length: 3, Actual: ${cellOutputs.length}`);
|
||||
let actualOutput0 = (<azdata.nb.IDisplayData>cellOutputs[0]).data['text/html'];
|
||||
console.log('Got first output');
|
||||
assert(actualOutput0 === expectedOutput0, `Expected row count: '${expectedOutput0}', Acutal: '${actualOutput0}'`);
|
||||
assert(actualOutput0 === expectedOutput0, `Expected row count: ${expectedOutput0}, Actual: ${actualOutput0}`);
|
||||
let actualOutput2 = (<azdata.nb.IExecuteResult>cellOutputs[2]).data['application/vnd.dataresource+json'].data[0];
|
||||
assert(actualOutput2[0] === '1', `Expected result: 1, Acutal: '${actualOutput2[0]}'`);
|
||||
assert(actualOutput2[0] === '1', `Expected result: 1, Actual: '${actualOutput2[0]}'`);
|
||||
|
||||
if (fs.existsSync(notebook.document.fileName)) {
|
||||
fs.unlink(notebook.document.fileName);
|
||||
fs.unlinkSync(notebook.document.fileName);
|
||||
}
|
||||
console.log('Sql NB done');
|
||||
console.log(`"${testName}" done`);
|
||||
});
|
||||
|
||||
// test('Python3 notebook test', async function () {
|
||||
@@ -43,7 +44,7 @@ if (context.RunTest) {
|
||||
// let cellOutputs = notebook.document.cells[0].contents.outputs;
|
||||
// console.log('Got cell outputs');
|
||||
// let result = (<azdata.nb.IExecuteResult>cellOutputs[0]).data['text/plain'];
|
||||
// assert(result === '2', `Expected: 2, Acutal: '${result}'`);
|
||||
// assert(result === '2', `Expected: 2, Actual: ${result}`);
|
||||
// console.log('Python3 NB done');
|
||||
// });
|
||||
|
||||
@@ -56,7 +57,7 @@ if (context.RunTest) {
|
||||
// let clearedOutputs = await notebook.clearAllOutputs();
|
||||
// let cells = notebook.document.cells;
|
||||
// cells.forEach(cell => {
|
||||
// assert(cell.contents && cell.contents.outputs && cell.contents.outputs.length === 0, `Expected Output: 0, Acutal: '${cell.contents.outputs.length}'`);
|
||||
// assert(cell.contents && cell.contents.outputs && cell.contents.outputs.length === 0, `Expected Output: 0, Actual: '${cell.contents.outputs.length}'`);
|
||||
// });
|
||||
// assert(clearedOutputs, 'Outputs of all the code cells from Python notebook should be cleared');
|
||||
// console.log("After clearing cell outputs");
|
||||
@@ -88,7 +89,7 @@ if (context.RunTest) {
|
||||
// let notebook = await openNotebook(pySparkNotebookContent, pySpark3KernelMetadata);
|
||||
// let cellOutputs = notebook.document.cells[0].contents.outputs;
|
||||
// let sparkResult = (<azdata.nb.IStreamResult>cellOutputs[3]).text;
|
||||
// assert(sparkResult === '2', `Expected: 2, Acutal: '${sparkResult}'`);
|
||||
// assert(sparkResult === '2', `Expected: 2, Actual: ${sparkResult}`);
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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}"`);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,13 +17,32 @@ if (!context.RunTest) {
|
||||
await vscode.commands.executeCommand('test.setupIntegrationTest');
|
||||
//Reload the window, this is required for some changes made by the 'test.setupIntegrationTest' to work
|
||||
await vscode.commands.executeCommand('workbench.action.reloadWindow');
|
||||
|
||||
});
|
||||
test('test setup verify BDC instance variables', async function () {
|
||||
console.log(`BDC_BACKEND_HOSTNAME: '${process.env.BDC_BACKEND_HOSTNAME}', BDC_BACKEND_USERNAME: '${process.env.BDC_BACKEND_USERNAME}'`);
|
||||
console.log(`PYTHON_TEST_PATH: '${process.env.PYTHON_TEST_PATH}'`);
|
||||
assert(process.env.BDC_BACKEND_HOSTNAME !== undefined &&
|
||||
process.env.BDC_BACKEND_USERNAME !== undefined &&
|
||||
process.env.BDC_BACKEND_PWD !== undefined &&
|
||||
process.env.STANDALONE_SQL_PWD !== undefined &&
|
||||
process.env.PYTHON_TEST_PATH !== undefined, 'Test setup requirs BDC_BACKEND_HOSTNAME, BDC_BACKEND_USERNAME, BDC_BACKEND_PWD, and PYTHON_TEST_PATH must be set using ./scripts/setbackenvariables.sh or .\\scripts\\setbackendvaraibles.bat');
|
||||
console.log('BDC instance variables are verified.');
|
||||
});
|
||||
test('test setup verify standalone instance variables', async function () {
|
||||
console.log(`STANDALONE_SQL: '${process.env.STANDALONE_SQL}', STANDALONE_SQL_USERNAME: '${process.env.STANDALONE_SQL_USERNAME}'`);
|
||||
assert(process.env.STANDALONE_SQL !== undefined &&
|
||||
process.env.STANDALONE_SQL_USERNAME !== undefined &&
|
||||
process.env.PYTHON_TEST_PATH, 'BDC_BACKEND_HOSTNAME, BDC_BACKEND_USERNAME, BDC_BACKEND_PWD must be set using ./scripts/setbackenvariables.sh or .\\scripts\\setbackendvaraibles.bat');
|
||||
process.env.STANDALONE_SQL_PWD !== undefined, 'Test setup requirs STANDALONE_SQL, STANDALONE_SQL_USERNAME and STANDALONE_SQL_PWD must be set using ./scripts/setbackenvariables.sh or .\\scripts\\setbackendvaraibles.bat');
|
||||
|
||||
console.log('Standalone instance variables are verified.');
|
||||
});
|
||||
|
||||
test('test setup verify azure instance variables', async function () {
|
||||
console.log(`AZURE_SQL: '${process.env.AZURE_SQL}', AZURE_SQL_USERNAME: '${process.env.AZURE_SQL_USERNAME}'`);
|
||||
assert(process.env.AZURE_SQL !== undefined &&
|
||||
process.env.AZURE_SQL_USERNAME !== undefined &&
|
||||
process.env.AZURE_SQL_PWD !== undefined, 'Test setup requirs AZURE_SQL, AZURE_SQL_USERNAME and AZURE_SQL_PWD must be set using ./scripts/setbackenvariables.sh or .\\scripts\\setbackendvaraibles.bat');
|
||||
|
||||
console.log('Azure instance variables are verified.');
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export class TestServerProfile {
|
||||
var TestingServers: TestServerProfile[] = [
|
||||
new TestServerProfile(
|
||||
{
|
||||
serverName: 'SQLTOOLS2017-3',
|
||||
serverName: process.env.STANDALONE_SQL,
|
||||
userName: process.env.STANDALONE_SQL_USERNAME,
|
||||
password: process.env.STANDALONE_SQL_PWD,
|
||||
authenticationType: AuthenticationType.SqlLogin,
|
||||
@@ -67,6 +67,16 @@ var TestingServers: TestServerProfile[] = [
|
||||
provider: ConnectionProvider.SQLServer,
|
||||
version: '2017'
|
||||
}),
|
||||
new TestServerProfile(
|
||||
{
|
||||
serverName: process.env.AZURE_SQL,
|
||||
userName: process.env.AZURE_SQL_USERNAME,
|
||||
password: process.env.AZURE_SQL_PWD,
|
||||
authenticationType: AuthenticationType.SqlLogin,
|
||||
database: 'master',
|
||||
provider: ConnectionProvider.SQLServer,
|
||||
version: '2012'
|
||||
}),
|
||||
new TestServerProfile(
|
||||
{
|
||||
serverName: process.env.BDC_BACKEND_HOSTNAME,
|
||||
@@ -93,6 +103,16 @@ export async function getDefaultTestingServer(): Promise<TestServerProfile> {
|
||||
return servers[0];
|
||||
}
|
||||
|
||||
export async function getAzureServer(): Promise<TestServerProfile> {
|
||||
let servers = await getTestingServers();
|
||||
return servers.filter(s => s.version === '2012')[0];
|
||||
}
|
||||
|
||||
export async function getStandaloneServer(): Promise<TestServerProfile> {
|
||||
let servers = await getTestingServers();
|
||||
return servers.filter(s => s.version === '2017')[0];
|
||||
}
|
||||
|
||||
export async function getBdcServer(): Promise<TestServerProfile> {
|
||||
let servers = await getTestingServers();
|
||||
return servers.filter(s => s.version === '2019')[0];
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
@echo off pass in username password hostname of big data cluster, please use "" for BDC_BACKEND_HOSTNAME to include port.
|
||||
@echo For example: setbackendvariables.cmd sa pwd "23.101.143.196,31433" pythonPath adstest standaloneSqlPwd
|
||||
@echo For example: setbackendvariables.cmd sa pwd "23.101.143.196,31433" pythonPath standaloneSql standaloneSqlUser standaloneSqlPwd azureSql azureSqlUser azureSqlPwd
|
||||
set BDC_BACKEND_USERNAME=%~1
|
||||
set BDC_BACKEND_PWD=%~2
|
||||
set BDC_BACKEND_HOSTNAME=%~3
|
||||
set PYTHON_TEST_PATH=%~4
|
||||
set STANDALONE_SQL_USERNAME=%~5
|
||||
set STANDALONE_SQL_PWD=%~6
|
||||
@echo No problem reading %BDC_BACKEND_USERNAME%, password, %BDC_BACKEND_HOSTNAME%, %PYTHON_TEST_PATH%, %STANDALONE_SQL_USERNAME% and %STANDALONE_SQL_PWD%
|
||||
|
||||
set STANDALONE_SQL=%~5
|
||||
set STANDALONE_SQL_USERNAME=%~6
|
||||
set STANDALONE_SQL_PWD=%~7
|
||||
|
||||
set AZURE_SQL=%~8
|
||||
set AZURE_SQL_USERNAME=%~9
|
||||
shift
|
||||
set AZURE_SQL_PWD=%~9
|
||||
|
||||
@echo No problem reading BDC cluster: %BDC_BACKEND_USERNAME%, bdc_password, %BDC_BACKEND_HOSTNAME% and %PYTHON_TEST_PATH%
|
||||
@echo No problem reading Standalone SQL instance: %STANDALONE_SQL%, %STANDALONE_SQL_USERNAME% and standalone_sql_password
|
||||
@echo No problem reading AZURE SQL instance: %AZURE_SQL%, %AZURE_SQL_USERNAME% and %AZURE_SQL_PWD%
|
||||
@@ -3,7 +3,17 @@ export BDC_BACKEND_USERNAME=$1
|
||||
export BDC_BACKEND_PWD=$2
|
||||
export BDC_BACKEND_HOSTNAME=$3
|
||||
export PYTHON_TEST_PATH=$4
|
||||
export STANDALONE_SQL_USERNAME=%~5
|
||||
export STANDALONE_SQL_PWD=%~6
|
||||
echo No problem reading $BDC_BACKEND_USERNAME, password, $BDC_BACKEND_HOSTNAME, $PYTHON_TEST_PATH, $STANDALONE_SQL_USERNAME and $STANDALONE_SQL_PWD
|
||||
|
||||
export STANDALONE_SQL=%~5
|
||||
export STANDALONE_SQL_USERNAME=%~6
|
||||
export STANDALONE_SQL_PWD=%~7
|
||||
|
||||
export AZURE_SQL=%~8
|
||||
export AZURE_SQL_USERNAME=%~9
|
||||
export AZURE_SQL_PWD=%~10
|
||||
|
||||
echo No problem reading BDC cluster$BDC_BACKEND_USERNAME, password, $BDC_BACKEND_HOSTNAME and $PYTHON_TEST_PATH,
|
||||
echo No problem reading Standalone SQL instance: $STANDALONE_SQL, $STANDALONE_SQL_USERNAME and $STANDALONE_SQL_PWD
|
||||
echo No problem reading AZURE SQL instance: $AZURE_SQL, $AZURE_SQL_USERNAME and $AZURE_SQL_PWD
|
||||
|
||||
set
|
||||
Reference in New Issue
Block a user