First version of Stress (#5499)

* First version of Stress - moving over from feat/Stress1 branch

* a working version - still issues with stresssified notebook tests

* update notebooks to use new message event (#5395)

* Latest changes for notebook tests

* Stressify objectExplorer tests

* formatting changes

* removing the tracing added previously and ability to set tsc verbose option in tsconfig.json

* addressing review feedback

* addressing review feedback

* implementing runtime parameter for Stress

* addresing review feedback and moved out stress modules to its own project outside of azuredata source tree

* referencing adstest from the github location

* incorporating review feedback

* Review feedbak

* removing uncommong entries added to .gitignore

* removing unrelated change

* replacing debug/trace statements with console.info or cosole.warn statments in integration-tests\main.tx
This commit is contained in:
Arvind Ranasaria
2019-05-29 11:18:20 -07:00
committed by GitHub
parent 9a55ca3021
commit 9cae7a0a49
11 changed files with 686 additions and 683 deletions

View File

@@ -11,141 +11,164 @@ import { context } from './testContext';
import { getBdcServer, TestServerProfile, getAzureServer, getStandaloneServer } from './testConfig';
import { connectToServer, createDB, deleteDB } from './utils';
import assert = require('assert');
import { stressify } from 'adstest';
if (context.RunTest) {
suite('Object Explorer integration suite', () => {
test('BDC instance node label test', async function () {
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects', 'Data Services'];
let server = await getBdcServer();
await VerifyOeNode(server, 6000, expectedNodeLabel);
await (new ObjectExplorerTester()).bdcNodeLabelTest();
});
test('Standard alone instance node label test', async function () {
if (process.platform === 'win32') {
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects'];
let server = await getStandaloneServer();
await VerifyOeNode(server, 3000, expectedNodeLabel);
}
await (new ObjectExplorerTester()).standaloneNodeLabelTest();
});
test('Azure SQL DB instance node label test', async function () {
const expectedNodeLabel = ['Databases', 'Security'];
let server = await getAzureServer();
await VerifyOeNode(server, 3000, expectedNodeLabel);
await (new ObjectExplorerTester()).sqlDbNodeLabelTest();
});
test('Standard SQL DB context menu test', async function () {
let server = await getStandaloneServer();
let expectedActions: string[];
// Properties comes from the admin-tool-ext-win extension which is for Windows only, so the item won't show up on non-Win32 platforms
if (process.platform === 'win32') {
expectedActions = ['Manage', 'New Query', 'Disconnect', 'Delete Connection', 'Refresh', 'New Notebook', 'Data-tier Application wizard', 'Launch Profiler', 'Properties'];
} else {
expectedActions = ['Manage', 'New Query', 'Disconnect', 'Delete Connection', 'Refresh', 'New Notebook', 'Data-tier Application wizard', 'Launch Profiler'];
}
await verifyContextMenu(server, expectedActions);
await (new ObjectExplorerTester()).sqlDbContextMenuTest();
});
test('BDC instance context menu test', async function () {
let server = await getBdcServer();
let expectedActions: string[];
// Properties comes from the admin-tool-ext-win extension which is for Windows only, so the item won't show up on non-Win32 platforms
if (process.platform === 'win32') {
expectedActions = ['Manage', 'New Query', 'Disconnect', 'Delete Connection', 'Refresh', 'New Notebook', 'Data-tier Application wizard', 'Launch Profiler', 'Properties'];
} else {
expectedActions = ['Manage', 'New Query', 'Disconnect', 'Delete Connection', 'Refresh', 'New Notebook', 'Data-tier Application wizard', 'Launch Profiler'];
}
await verifyContextMenu(server, expectedActions);
await (new ObjectExplorerTester()).bdcContextMenuTest();
});
test('Azure SQL DB context menu test', async function () {
const server = await getAzureServer();
// Azure DB doesn't have Properties node on server level
const expectedActions = ['Manage', 'New Query', 'Disconnect', 'Delete Connection', 'Refresh', 'New Notebook', 'Data-tier Application wizard', 'Launch Profiler'];
await verifyContextMenu(server, expectedActions);
await (new ObjectExplorerTester()).sqlDbContextMenuTest();
});
test('Stand alone database context menu test', async function () {
let server = await getStandaloneServer();
let expectedActions: string[] = [];
if (process.platform === 'win32') {
expectedActions = ['Manage', 'New Query', 'Backup', 'Restore', 'Refresh', 'Data-tier Application wizard', 'Schema Compare', 'Import wizard', 'Generate Scripts...', 'Properties'];
}
else {
expectedActions = ['Manage', 'New Query', 'Backup', 'Restore', 'Refresh', 'Data-tier Application wizard', 'Schema Compare', 'Import wizard'];
}
await VerifyDBContextMenu(server, 3000, expectedActions);
await (new ObjectExplorerTester()).standAloneContextMenuTest();
});
});
}
async function verifyContextMenu(server: TestServerProfile, expectedActions: string[]): Promise<void> {
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}`);
class ObjectExplorerTester {
private static ParallelCount = 1;
let index = nodes.findIndex(node => node.nodePath.includes(server.serverName));
assert(index !== -1, `Failed to find server: "${server.serverName}" in OE tree`);
@stressify({ dop: ObjectExplorerTester.ParallelCount })
async bdcNodeLabelTest(): Promise<void> {
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects', 'Data Services'];
let server = await getBdcServer();
await this.verifyOeNode(server, 6000, expectedNodeLabel);
}
let node = nodes[index];
let actions = await azdata.objectexplorer.getNodeActions(node.connectionId, node.nodePath);
@stressify({ dop: ObjectExplorerTester.ParallelCount })
async standaloneNodeLabelTest(): Promise<void> {
if (process.platform === 'win32') {
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects'];
let server = await getStandaloneServer();
await this.verifyOeNode(server, 3000, expectedNodeLabel);
}
}
let expectedString = expectedActions.join(',');
const actualString = actions.join(',');
assert(expectedActions.length === actions.length && expectedString === actualString, `Expected actions: "${expectedString}", Actual actions: "${actualString}"`);
}
@stressify({ dop: ObjectExplorerTester.ParallelCount })
async sqlDbNodeLabelTest(): Promise<void> {
const expectedNodeLabel = ['Databases', 'Security'];
let server = await getAzureServer();
await this.verifyOeNode(server, 3000, expectedNodeLabel);
}
async function VerifyOeNode(server: TestServerProfile, timeout: number, expectedNodeLabel: string[]): Promise<void> {
await connectToServer(server, timeout);
let nodes = <azdata.objectexplorer.ObjectExplorerNode[]>await azdata.objectexplorer.getActiveConnectionNodes();
assert(nodes.length > 0, `Expecting at least one active connection, actual: ${nodes.length}`);
@stressify({ dop: ObjectExplorerTester.ParallelCount })
async sqlDbContextMenuTest(): Promise<void> {
let server = await getStandaloneServer();
let expectedActions: string[];
// Properties comes from the admin-tool-ext-win extension which is for Windows only, so the item won't show up on non-Win32 platforms
if (process.platform === 'win32') {
expectedActions = ['Manage', 'New Query', 'Disconnect', 'Delete Connection', 'Refresh', 'New Notebook', 'Data-tier Application wizard', 'Launch Profiler', 'Properties'];
}
else {
expectedActions = ['Manage', 'New Query', 'Disconnect', 'Delete Connection', 'Refresh', 'New Notebook', 'Data-tier Application wizard', 'Launch Profiler'];
}
await this.verifyContextMenu(server, expectedActions);
}
let index = nodes.findIndex(node => node.nodePath.includes(server.serverName));
assert(index !== -1, `Failed to find server: "${server.serverName}" in OE tree`);
let actualNodeLabel = [];
let children = await nodes[index].getChildren();
assert(children.length === expectedNodeLabel.length, `Expecting node count: ${expectedNodeLabel.length}, Actual: ${children.length}`);
@stressify({ dop: ObjectExplorerTester.ParallelCount })
async standAloneContextMenuTest(): Promise<void> {
let server = await getStandaloneServer();
let expectedActions: string[] = [];
if (process.platform === 'win32') {
expectedActions = ['Manage', 'New Query', 'Backup', 'Restore', 'Refresh', 'Data-tier Application wizard', 'Schema Compare', 'Import wizard', 'Generate Scripts...', 'Properties'];
}
else {
expectedActions = ['Manage', 'New Query', 'Backup', 'Restore', 'Refresh', 'Data-tier Application wizard', 'Schema Compare', 'Import wizard'];
}
await this.verifyDBContextMenu(server, 3000, expectedActions);
}
children.forEach(c => actualNodeLabel.push(c.label));
assert(expectedNodeLabel.toLocaleString() === actualNodeLabel.toLocaleString(), `Expected node label: "${expectedNodeLabel}", Actual: "${actualNodeLabel}"`);
}
@stressify({ dop: ObjectExplorerTester.ParallelCount })
async bdcContextMenuTest(): Promise<void> {
let server = await getBdcServer();
let expectedActions: string[];
// Properties comes from the admin-tool-ext-win extension which is for Windows only, so the item won't show up on non-Win32 platforms
if (process.platform === 'win32') {
expectedActions = ['Manage', 'New Query', 'Disconnect', 'Delete Connection', 'Refresh', 'New Notebook', 'Data-tier Application wizard', 'Launch Profiler', 'Properties'];
}
else {
expectedActions = ['Manage', 'New Query', 'Disconnect', 'Delete Connection', 'Refresh', 'New Notebook', 'Data-tier Application wizard', 'Launch Profiler'];
}
await this.verifyContextMenu(server, expectedActions);
}
async function VerifyDBContextMenu(server: TestServerProfile, timeoutinMS: number, expectedActions: string[]) {
async verifyContextMenu(server: TestServerProfile, expectedActions: string[]): Promise<void> {
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}`);
await connectToServer(server, timeoutinMS);
let index = nodes.findIndex(node => node.nodePath.includes(server.serverName));
assert(index !== -1, `Failed to find server: "${server.serverName}" in OE tree`);
let nodes = <azdata.objectexplorer.ObjectExplorerNode[]>await azdata.objectexplorer.getActiveConnectionNodes();
assert(nodes.length > 0, `Expecting at least one active connection, actual: ${nodes.length}`);
let node = nodes[index];
let actions = await azdata.objectexplorer.getNodeActions(node.connectionId, node.nodePath);
let index = nodes.findIndex(node => node.nodePath.includes(server.serverName));
assert(index !== -1, `Failed to find server: "${server.serverName}" in OE tree`);
let ownerUri = await azdata.connection.getUriForConnection(nodes[index].connectionId);
let dbName: string = 'ads_test_VerifyDBContextMenu_' + new Date().getTime().toString();
try {
await createDB(dbName, ownerUri);
let serverNode = nodes[index];
let children = await serverNode.getChildren();
assert(children[0].label.toLocaleLowerCase === 'Databases'.toLocaleLowerCase, `Expected Databases node. Actual ${children[0].label}`);
let databasesFolder = children[0];
let databases = await databasesFolder.getChildren();
assert(databases.length > 2, `No database present, can not test further`); // System Databses folder and at least one database
let actions = await azdata.objectexplorer.getNodeActions(databases[1].connectionId, databases[1].nodePath);
const expectedString = expectedActions.join(',');
let expectedString = expectedActions.join(',');
const actualString = actions.join(',');
assert(expectedActions.length === actions.length && expectedString === actualString, `Expected actions: "${expectedString}", Actual actions: "${actualString}"`);
}
finally {
await deleteDB(dbName, ownerUri);
async verifyOeNode(server: TestServerProfile, timeout: number, expectedNodeLabel: string[]): Promise<void> {
await connectToServer(server, timeout);
let nodes = <azdata.objectexplorer.ObjectExplorerNode[]>await azdata.objectexplorer.getActiveConnectionNodes();
assert(nodes.length > 0, `Expecting at least one active connection, actual: ${nodes.length}`);
let index = nodes.findIndex(node => node.nodePath.includes(server.serverName));
assert(index !== -1, `Failed to find server: "${server.serverName}" in OE tree`);
let actualNodeLabel = [];
let children = await nodes[index].getChildren();
assert(children.length === expectedNodeLabel.length, `Expecting node count: ${expectedNodeLabel.length}, Actual: ${children.length}`);
children.forEach(c => actualNodeLabel.push(c.label));
assert(expectedNodeLabel.toLocaleString() === actualNodeLabel.toLocaleString(), `Expected node label: "${expectedNodeLabel}", Actual: "${actualNodeLabel}"`);
}
async verifyDBContextMenu(server: TestServerProfile, timeoutinMS: number, expectedActions: string[]): Promise<void> {
await connectToServer(server, timeoutinMS);
let nodes = <azdata.objectexplorer.ObjectExplorerNode[]>await azdata.objectexplorer.getActiveConnectionNodes();
assert(nodes.length > 0, `Expecting at least one active connection, actual: ${nodes.length}`);
let index = nodes.findIndex(node => node.nodePath.includes(server.serverName));
assert(index !== -1, `Failed to find server: "${server.serverName}" in OE tree`);
let ownerUri = await azdata.connection.getUriForConnection(nodes[index].connectionId);
let dbName: string = 'ads_test_VerifyDBContextMenu_' + new Date().getTime().toString();
try {
await createDB(dbName, ownerUri);
let serverNode = nodes[index];
let children = await serverNode.getChildren();
assert(children[0].label.toLocaleLowerCase === 'Databases'.toLocaleLowerCase, `Expected Databases node. Actual ${children[0].label}`);
let databasesFolder = children[0];
let databases = await databasesFolder.getChildren();
assert(databases.length > 2, `No database present, can not test further`); // System Databses folder and at least one database
let actions = await azdata.objectexplorer.getNodeActions(databases[1].connectionId, databases[1].nodePath);
const expectedString = expectedActions.join(',');
const actualString = actions.join(',');
assert(expectedActions.length === actions.length && expectedString === actualString, `Expected actions: "${expectedString}", Actual actions: "${actualString}"`);
}
finally {
await deleteDB(dbName, ownerUri);
}
}
}