mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Use the default connect timeout in OE tests (#7249)
This commit is contained in:
@@ -9,7 +9,7 @@ import 'mocha';
|
|||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { context } from './testContext';
|
import { context } from './testContext';
|
||||||
import { getBdcServer, TestServerProfile, getAzureServer, getStandaloneServer } from './testConfig';
|
import { getBdcServer, TestServerProfile, getAzureServer, getStandaloneServer } from './testConfig';
|
||||||
import { connectToServer, createDB, deleteDB } from './utils';
|
import { connectToServer, createDB, deleteDB, DefaultConnectTimeoutInMs } from './utils';
|
||||||
import assert = require('assert');
|
import assert = require('assert');
|
||||||
import { stressify } from 'adstest';
|
import { stressify } from 'adstest';
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ class ObjectExplorerTester {
|
|||||||
async bdcNodeLabelTest(): Promise<void> {
|
async bdcNodeLabelTest(): Promise<void> {
|
||||||
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects', 'Data Services'];
|
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects', 'Data Services'];
|
||||||
const server = await getBdcServer();
|
const server = await getBdcServer();
|
||||||
await this.verifyOeNode(server, 6000, expectedNodeLabel);
|
await this.verifyOeNode(server, DefaultConnectTimeoutInMs, expectedNodeLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@stressify({ dop: ObjectExplorerTester.ParallelCount })
|
@stressify({ dop: ObjectExplorerTester.ParallelCount })
|
||||||
@@ -51,7 +51,7 @@ class ObjectExplorerTester {
|
|||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects'];
|
const expectedNodeLabel = ['Databases', 'Security', 'Server Objects'];
|
||||||
const server = await getStandaloneServer();
|
const server = await getStandaloneServer();
|
||||||
await this.verifyOeNode(server, 3000, expectedNodeLabel);
|
await this.verifyOeNode(server, DefaultConnectTimeoutInMs, expectedNodeLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ class ObjectExplorerTester {
|
|||||||
async sqlDbNodeLabelTest(): Promise<void> {
|
async sqlDbNodeLabelTest(): Promise<void> {
|
||||||
const expectedNodeLabel = ['Databases', 'Security'];
|
const expectedNodeLabel = ['Databases', 'Security'];
|
||||||
const server = await getAzureServer();
|
const server = await getAzureServer();
|
||||||
await this.verifyOeNode(server, 3000, expectedNodeLabel);
|
await this.verifyOeNode(server, DefaultConnectTimeoutInMs, expectedNodeLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@stressify({ dop: ObjectExplorerTester.ParallelCount })
|
@stressify({ dop: ObjectExplorerTester.ParallelCount })
|
||||||
@@ -80,7 +80,7 @@ class ObjectExplorerTester {
|
|||||||
else {
|
else {
|
||||||
expectedActions = ['Manage', 'New Query', 'New Notebook', 'Refresh', 'Backup', 'Restore', 'Data-tier Application wizard', 'Schema Compare', 'Import wizard'];
|
expectedActions = ['Manage', 'New Query', 'New Notebook', 'Refresh', 'Backup', 'Restore', 'Data-tier Application wizard', 'Schema Compare', 'Import wizard'];
|
||||||
}
|
}
|
||||||
await this.verifyDBContextMenu(server, 3000, expectedActions);
|
await this.verifyDBContextMenu(server, DefaultConnectTimeoutInMs, expectedActions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@stressify({ dop: ObjectExplorerTester.ParallelCount })
|
@stressify({ dop: ObjectExplorerTester.ParallelCount })
|
||||||
@@ -98,7 +98,7 @@ class ObjectExplorerTester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async verifyContextMenu(server: TestServerProfile, expectedActions: string[]): Promise<void> {
|
async verifyContextMenu(server: TestServerProfile, expectedActions: string[]): Promise<void> {
|
||||||
await connectToServer(server, 3000);
|
await connectToServer(server, DefaultConnectTimeoutInMs);
|
||||||
const nodes = <azdata.objectexplorer.ObjectExplorerNode[]>await azdata.objectexplorer.getActiveConnectionNodes();
|
const nodes = <azdata.objectexplorer.ObjectExplorerNode[]>await azdata.objectexplorer.getActiveConnectionNodes();
|
||||||
assert(nodes.length > 0, `Expecting at least one active connection, actual: ${nodes.length}`);
|
assert(nodes.length > 0, `Expecting at least one active connection, actual: ${nodes.length}`);
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,15 @@ import * as vscode from 'vscode';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { TestServerProfile } from './testConfig';
|
import { TestServerProfile } from './testConfig';
|
||||||
|
|
||||||
|
// default server connection timeout
|
||||||
|
export const DefaultConnectTimeoutInMs: number = 10000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param server test connection profile
|
* @param server test connection profile
|
||||||
* @param timeout optional timeout parameter
|
* @param timeout optional timeout parameter
|
||||||
* Returns connection id for a new connection
|
* Returns connection id for a new connection
|
||||||
*/
|
*/
|
||||||
export async function connectToServer(server: TestServerProfile, timeout: number = 10000): Promise<string> {
|
export async function connectToServer(server: TestServerProfile, timeout: number = DefaultConnectTimeoutInMs): Promise<string> {
|
||||||
let connectionProfile: azdata.IConnectionProfile = {
|
let connectionProfile: azdata.IConnectionProfile = {
|
||||||
serverName: server.serverName,
|
serverName: server.serverName,
|
||||||
databaseName: server.database,
|
databaseName: server.database,
|
||||||
|
|||||||
Reference in New Issue
Block a user