mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Alanren/fixsmoketest (#5019)
* fix the smoke test * update readme * fix the selector for server name input * add new property to server profile engineType
This commit is contained in:
@@ -7,7 +7,10 @@ The integration-tests suite is based on the extension testing feature provided b
|
|||||||
* extensionInstallers folder: Copy the VISX installers for the extensions we would like to run the tests with.
|
* extensionInstallers folder: Copy the VISX installers for the extensions we would like to run the tests with.
|
||||||
* src folder: This is where the test file for features should be added, name the file like this: feature.test.ts. e.g. objectExplorer.test.ts
|
* src folder: This is where the test file for features should be added, name the file like this: feature.test.ts. e.g. objectExplorer.test.ts
|
||||||
|
|
||||||
ADS will be launched using new temp folders: extension folder and data folder so that your local dev environment won't be changed.
|
## UI automation testing
|
||||||
|
The UI automation test cases should be added under $root/test/smoke/src/sql folder. Each feature should create its own folder and add 2 files, one for accessing the feature and the other for the test cases. For example: objectExplorer.ts and objectExplorer.test.ts. only tested on Windows for now.
|
||||||
|
|
||||||
|
For both Smoke test and Integration test, ADS will be launched using new temp folders: extension folder and data folder so that your local dev environment won't be changed.
|
||||||
|
|
||||||
## How to run the test
|
## How to run the test
|
||||||
1. In the build pipeline:
|
1. In the build pipeline:
|
||||||
@@ -20,15 +23,8 @@ The integration test suite has been added to ADS windows pipeline to run the tes
|
|||||||
2. Git-Bash on Windows: node setEnvironmentVariables.js BashWin
|
2. Git-Bash on Windows: node setEnvironmentVariables.js BashWin
|
||||||
3. Follow the instructions in the window: you will be prompted to login to azure portal.
|
3. Follow the instructions in the window: you will be prompted to login to azure portal.
|
||||||
4. A new window will be opened based on your selection and the new window will have the required environment variables set.
|
4. A new window will be opened based on your selection and the new window will have the required environment variables set.
|
||||||
5. In the new window navigate to the scripts folder and run sql-test-integration.bat or sql-test-integration.sh based on your environment.
|
5. Run the Test:
|
||||||
|
1. For Integration Test: in the new window navigate to the scripts folder and run sql-test-integration.bat or sql-test-integration.sh based on your environment.
|
||||||
## UI automation testing
|
2. Smoke Test can be launched in 2 ways:
|
||||||
The UI automation test cases should be added under $root/test/smoke/src/sql folder. Each feature should create its own folder and add 2 files, one for accessing the feature and the other for the test cases. For example: objectExplorer.ts and objectExplorer.test.ts. only tested on Windows for now.
|
1. In the new window navigate to the test/smoke folder and run: node smoke/index.js
|
||||||
|
2. Or, In a VSCode window opened by step above, open AzureDataStudio folder and then select the 'Launch Smoke Test' option.
|
||||||
## How to run the test
|
|
||||||
1. In the build pipeline:
|
|
||||||
The smoke test suite has been added to ADS windows pipeline to run the test and report the results, you can find the test results under the test tab.
|
|
||||||
|
|
||||||
2. Local environment
|
|
||||||
navigate to test/smoke folder and run: node test/index.js
|
|
||||||
You can also run UI automation from VSCode by selecting the launch option: Launch Smoke Test.
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import * as azdata from 'azdata';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { context } from './testContext';
|
import { context } from './testContext';
|
||||||
import { sqlNotebookContent, writeNotebookToFile, sqlKernelMetadata, getFileName, pySparkNotebookContent, pySpark3KernelMetadata, pythonKernelMetadata, sqlNotebookMultipleCellsContent } from './notebook.util';
|
import { sqlNotebookContent, writeNotebookToFile, sqlKernelMetadata, getFileName, pySparkNotebookContent, pySpark3KernelMetadata, pythonKernelMetadata, sqlNotebookMultipleCellsContent } from './notebook.util';
|
||||||
import { getBdcServer } from './testConfig';
|
import { getBdcServer, getConfigValue, EnvironmentVariable_PYTHON_PATH } from './testConfig';
|
||||||
import { connectToServer, getConfigValue, EnvironmentVariable_PYTHON_PATH } from './utils';
|
import { connectToServer } from './utils';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
if (context.RunTest) {
|
if (context.RunTest) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import 'mocha';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { context } from './testContext';
|
import { context } from './testContext';
|
||||||
import assert = require('assert');
|
import assert = require('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 './utils';
|
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';
|
||||||
|
|
||||||
assert(getConfigValue(EnvironmentVariable_BDC_SERVER) !== undefined &&
|
assert(getConfigValue(EnvironmentVariable_BDC_SERVER) !== undefined &&
|
||||||
getConfigValue(EnvironmentVariable_BDC_USERNAME) !== undefined &&
|
getConfigValue(EnvironmentVariable_BDC_USERNAME) !== undefined &&
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { getConfigValue, EnvironmentVariable_STANDALONE_SERVER, EnvironmentVariable_STANDALONE_USERNAME, EnvironmentVariable_STANDALONE_PASSWORD, EnvironmentVariable_AZURE_SERVER, EnvironmentVariable_AZURE_USERNAME, EnvironmentVariable_AZURE_PASSWORD, EnvironmentVariable_BDC_SERVER, EnvironmentVariable_BDC_USERNAME, EnvironmentVariable_BDC_PASSWORD } from './utils';
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------------------------
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* 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.
|
||||||
@@ -20,6 +18,7 @@ interface ITestServerProfile {
|
|||||||
database: string;
|
database: string;
|
||||||
provider: ConnectionProvider;
|
provider: ConnectionProvider;
|
||||||
version: string;
|
version: string;
|
||||||
|
engineType: EngineType;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface INameDisplayNamePair {
|
interface INameDisplayNamePair {
|
||||||
@@ -36,6 +35,12 @@ export enum ConnectionProvider {
|
|||||||
SQLServer
|
SQLServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum EngineType {
|
||||||
|
Standalone,
|
||||||
|
Azure,
|
||||||
|
BigDataCluster
|
||||||
|
}
|
||||||
|
|
||||||
var connectionProviderMapping = {};
|
var connectionProviderMapping = {};
|
||||||
var authenticationTypeMapping = {};
|
var authenticationTypeMapping = {};
|
||||||
connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' };
|
connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' };
|
||||||
@@ -43,6 +48,22 @@ connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displ
|
|||||||
authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' };
|
authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' };
|
||||||
authenticationTypeMapping[AuthenticationType.Windows] = { name: 'Integrated', displayName: 'Windows Authentication' };
|
authenticationTypeMapping[AuthenticationType.Windows] = { name: 'Integrated', displayName: 'Windows Authentication' };
|
||||||
|
|
||||||
|
export function getConfigValue(name: string): string {
|
||||||
|
let configValue = process.env[name];
|
||||||
|
return configValue ? configValue.toString() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
export const EnvironmentVariable_BDC_SERVER: string = 'BDC_BACKEND_HOSTNAME';
|
||||||
|
export const EnvironmentVariable_BDC_USERNAME: string = 'BDC_BACKEND_USERNAME';
|
||||||
|
export const EnvironmentVariable_BDC_PASSWORD: string = 'BDC_BACKEND_PWD';
|
||||||
|
export const EnvironmentVariable_STANDALONE_SERVER: string = 'STANDALONE_SQL';
|
||||||
|
export const EnvironmentVariable_STANDALONE_USERNAME: string = 'STANDALONE_SQL_USERNAME';
|
||||||
|
export const EnvironmentVariable_STANDALONE_PASSWORD: string = 'STANDALONE_SQL_PWD';
|
||||||
|
export const EnvironmentVariable_AZURE_SERVER: string = 'AZURE_SQL';
|
||||||
|
export const EnvironmentVariable_AZURE_USERNAME: string = 'AZURE_SQL_USERNAME';
|
||||||
|
export const EnvironmentVariable_AZURE_PASSWORD: string = 'AZURE_SQL_PWD';
|
||||||
|
export const EnvironmentVariable_PYTHON_PATH: string = 'PYTHON_TEST_PATH';
|
||||||
|
|
||||||
export class TestServerProfile {
|
export class TestServerProfile {
|
||||||
constructor(private _profile: ITestServerProfile) { }
|
constructor(private _profile: ITestServerProfile) { }
|
||||||
public get serverName(): string { return this._profile.serverName; }
|
public get serverName(): string { return this._profile.serverName; }
|
||||||
@@ -56,6 +77,7 @@ export class TestServerProfile {
|
|||||||
public get authenticationType(): AuthenticationType { return this._profile.authenticationType; }
|
public get authenticationType(): AuthenticationType { return this._profile.authenticationType; }
|
||||||
public get authenticationTypeName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).name; }
|
public get authenticationTypeName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).name; }
|
||||||
public get authenticationTypeDisplayName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).displayName; }
|
public get authenticationTypeDisplayName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).displayName; }
|
||||||
|
public get engineType(): EngineType { return this._profile.engineType; }
|
||||||
}
|
}
|
||||||
|
|
||||||
var TestingServers: TestServerProfile[] = [
|
var TestingServers: TestServerProfile[] = [
|
||||||
@@ -67,7 +89,8 @@ var TestingServers: TestServerProfile[] = [
|
|||||||
authenticationType: AuthenticationType.SqlLogin,
|
authenticationType: AuthenticationType.SqlLogin,
|
||||||
database: 'master',
|
database: 'master',
|
||||||
provider: ConnectionProvider.SQLServer,
|
provider: ConnectionProvider.SQLServer,
|
||||||
version: '2017'
|
version: '2017',
|
||||||
|
engineType: EngineType.Standalone
|
||||||
}),
|
}),
|
||||||
new TestServerProfile(
|
new TestServerProfile(
|
||||||
{
|
{
|
||||||
@@ -77,7 +100,8 @@ var TestingServers: TestServerProfile[] = [
|
|||||||
authenticationType: AuthenticationType.SqlLogin,
|
authenticationType: AuthenticationType.SqlLogin,
|
||||||
database: 'master',
|
database: 'master',
|
||||||
provider: ConnectionProvider.SQLServer,
|
provider: ConnectionProvider.SQLServer,
|
||||||
version: '2012'
|
version: '2012',
|
||||||
|
engineType: EngineType.Azure
|
||||||
}),
|
}),
|
||||||
new TestServerProfile(
|
new TestServerProfile(
|
||||||
{
|
{
|
||||||
@@ -87,7 +111,8 @@ var TestingServers: TestServerProfile[] = [
|
|||||||
authenticationType: AuthenticationType.SqlLogin,
|
authenticationType: AuthenticationType.SqlLogin,
|
||||||
database: 'master',
|
database: 'master',
|
||||||
provider: ConnectionProvider.SQLServer,
|
provider: ConnectionProvider.SQLServer,
|
||||||
version: '2019'
|
version: '2019',
|
||||||
|
engineType: EngineType.BigDataCluster
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -100,24 +125,19 @@ function getEnumMappingEntry(mapping: any, enumValue: any): INameDisplayNamePair
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getDefaultTestingServer(): Promise<TestServerProfile> {
|
|
||||||
let servers = await getTestingServers();
|
|
||||||
return servers[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getAzureServer(): Promise<TestServerProfile> {
|
export async function getAzureServer(): Promise<TestServerProfile> {
|
||||||
let servers = await getTestingServers();
|
let servers = await getTestingServers();
|
||||||
return servers.filter(s => s.version === '2012')[0];
|
return servers.filter(s => s.engineType === EngineType.Azure)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getStandaloneServer(): Promise<TestServerProfile> {
|
export async function getStandaloneServer(): Promise<TestServerProfile> {
|
||||||
let servers = await getTestingServers();
|
let servers = await getTestingServers();
|
||||||
return servers.filter(s => s.version === '2017')[0];
|
return servers.filter(s => s.version === '2017' && s.engineType === EngineType.Standalone)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getBdcServer(): Promise<TestServerProfile> {
|
export async function getBdcServer(): Promise<TestServerProfile> {
|
||||||
let servers = await getTestingServers();
|
let servers = await getTestingServers();
|
||||||
return servers.filter(s => s.version === '2019')[0];
|
return servers.filter(s => s.version === '2019' && s.engineType === EngineType.BigDataCluster)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getTestingServers(): Promise<TestServerProfile[]> {
|
export async function getTestingServers(): Promise<TestServerProfile[]> {
|
||||||
|
|||||||
@@ -36,18 +36,3 @@ export async function connectToServer(server: TestServerProfile, timeout: number
|
|||||||
export async function ensureConnectionViewOpened() {
|
export async function ensureConnectionViewOpened() {
|
||||||
await vscode.commands.executeCommand('dataExplorer.servers.focus');
|
await vscode.commands.executeCommand('dataExplorer.servers.focus');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getConfigValue(name: string): string {
|
|
||||||
return process.env[name];
|
|
||||||
}
|
|
||||||
|
|
||||||
export const EnvironmentVariable_BDC_SERVER: string = 'BDC_BACKEND_HOSTNAME';
|
|
||||||
export const EnvironmentVariable_BDC_USERNAME: string = 'BDC_BACKEND_USERNAME';
|
|
||||||
export const EnvironmentVariable_BDC_PASSWORD: string = 'BDC_BACKEND_PWD';
|
|
||||||
export const EnvironmentVariable_STANDALONE_SERVER: string = 'STANDALONE_SQL';
|
|
||||||
export const EnvironmentVariable_STANDALONE_USERNAME: string = 'STANDALONE_SQL_USERNAME';
|
|
||||||
export const EnvironmentVariable_STANDALONE_PASSWORD: string = 'STANDALONE_SQL_PWD';
|
|
||||||
export const EnvironmentVariable_AZURE_SERVER: string = 'AZURE_SQL';
|
|
||||||
export const EnvironmentVariable_AZURE_USERNAME: string = 'AZURE_SQL_USERNAME';
|
|
||||||
export const EnvironmentVariable_AZURE_PASSWORD: string = 'AZURE_SQL_PWD';
|
|
||||||
export const EnvironmentVariable_PYTHON_PATH: string = 'PYTHON_TEST_PATH';
|
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ class SelectListRenderer implements IListRenderer<ISelectOptionItem, ISelectList
|
|||||||
|
|
||||||
data.text.textContent = text;
|
data.text.textContent = text;
|
||||||
data.decoratorRight.innerText = (!!decoratorRight ? decoratorRight : '');
|
data.decoratorRight.innerText = (!!decoratorRight ? decoratorRight : '');
|
||||||
|
// {{SQL CARBON EDIT}}
|
||||||
|
data.text.setAttribute('aria-label', text);
|
||||||
|
|
||||||
if (typeof element.description === 'string') {
|
if (typeof element.description === 'string') {
|
||||||
const itemDescriptionId = (text.replace(/ /g, '_').toLowerCase() + '_description_' + data.root.id);
|
const itemDescriptionId = (text.replace(/ /g, '_').toLowerCase() + '_description_' + data.root.id);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { TestServerProfile, AuthenticationType } from '../testConfig';
|
|||||||
|
|
||||||
const CONNECTION_DIALOG_TITLE = 'Connection';
|
const CONNECTION_DIALOG_TITLE = 'Connection';
|
||||||
const CONNECTION_DIALOG_SELECTOR: string = '.modal-dialog .modal-content .modal-body .connection-dialog';
|
const CONNECTION_DIALOG_SELECTOR: string = '.modal-dialog .modal-content .modal-body .connection-dialog';
|
||||||
const CONNECTION_DETAIL_CONTROL_SELECTOR: string = '.connection-type .connection-table .connection-input';
|
const CONNECTION_DETAIL_CONTROL_SELECTOR: string = '.connection-provider-info .connection-table .connection-input';
|
||||||
|
|
||||||
const SERVER_INPUT_ARIA_LABEL = 'Server';
|
const SERVER_INPUT_ARIA_LABEL = 'Server';
|
||||||
const USERNAME_INPUT_ARIA_LABEL = 'User name';
|
const USERNAME_INPUT_ARIA_LABEL = 'User name';
|
||||||
@@ -46,6 +46,6 @@ export class ConnectionDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async selectAuthType(authType: string) {
|
private async selectAuthType(authType: string) {
|
||||||
await this.code.waitAndClick(`.context-view.bottom.left .monaco-select-box-dropdown-container .select-box-dropdown-list-container .monaco-list .monaco-scrollable-element .monaco-list-rows div[aria-label="${authType}"][class*="monaco-list-row"]`);
|
await this.code.waitAndClick(`.context-view.bottom.left .monaco-select-box-dropdown-container .select-box-dropdown-list-container .monaco-list .monaco-scrollable-element .monaco-list-rows .monaco-list-row div[aria-label="${authType}"][class*="option-text"]`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { Application } from '../../application';
|
import { Application } from '../../application';
|
||||||
import { getDefaultTestingServer } from '../testConfig';
|
import { getStandaloneServer } from '../testConfig';
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
describe('profiler test suite', () => {
|
describe('profiler test suite', () => {
|
||||||
@@ -12,7 +12,7 @@ export function setup() {
|
|||||||
const app = this.app as Application;
|
const app = this.app as Application;
|
||||||
await app.workbench.profiler.launchProfiler();
|
await app.workbench.profiler.launchProfiler();
|
||||||
await app.workbench.connectionDialog.waitForConnectionDialog();
|
await app.workbench.connectionDialog.waitForConnectionDialog();
|
||||||
await app.workbench.connectionDialog.connect(await getDefaultTestingServer());
|
await app.workbench.connectionDialog.connect(await getStandaloneServer());
|
||||||
await app.workbench.profiler.waitForNewSessionDialogAndStart();
|
await app.workbench.profiler.waitForNewSessionDialogAndStart();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ interface ITestServerProfile {
|
|||||||
database: string;
|
database: string;
|
||||||
provider: ConnectionProvider;
|
provider: ConnectionProvider;
|
||||||
version: string;
|
version: string;
|
||||||
|
engineType: EngineType;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface INameDisplayNamePair {
|
interface INameDisplayNamePair {
|
||||||
@@ -34,6 +35,12 @@ export enum ConnectionProvider {
|
|||||||
SQLServer
|
SQLServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum EngineType {
|
||||||
|
Standalone,
|
||||||
|
Azure,
|
||||||
|
BigDataCluster
|
||||||
|
}
|
||||||
|
|
||||||
var connectionProviderMapping = {};
|
var connectionProviderMapping = {};
|
||||||
var authenticationTypeMapping = {};
|
var authenticationTypeMapping = {};
|
||||||
connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' };
|
connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displayName: 'Microsoft SQL Server' };
|
||||||
@@ -41,6 +48,22 @@ connectionProviderMapping[ConnectionProvider.SQLServer] = { name: 'MSSQL', displ
|
|||||||
authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' };
|
authenticationTypeMapping[AuthenticationType.SqlLogin] = { name: 'SqlLogin', displayName: 'SQL Login' };
|
||||||
authenticationTypeMapping[AuthenticationType.Windows] = { name: 'Integrated', displayName: 'Windows Authentication' };
|
authenticationTypeMapping[AuthenticationType.Windows] = { name: 'Integrated', displayName: 'Windows Authentication' };
|
||||||
|
|
||||||
|
export function getConfigValue(name: string): string {
|
||||||
|
let configValue = process.env[name];
|
||||||
|
return configValue ? configValue.toString() : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
export const EnvironmentVariable_BDC_SERVER: string = 'BDC_BACKEND_HOSTNAME';
|
||||||
|
export const EnvironmentVariable_BDC_USERNAME: string = 'BDC_BACKEND_USERNAME';
|
||||||
|
export const EnvironmentVariable_BDC_PASSWORD: string = 'BDC_BACKEND_PWD';
|
||||||
|
export const EnvironmentVariable_STANDALONE_SERVER: string = 'STANDALONE_SQL';
|
||||||
|
export const EnvironmentVariable_STANDALONE_USERNAME: string = 'STANDALONE_SQL_USERNAME';
|
||||||
|
export const EnvironmentVariable_STANDALONE_PASSWORD: string = 'STANDALONE_SQL_PWD';
|
||||||
|
export const EnvironmentVariable_AZURE_SERVER: string = 'AZURE_SQL';
|
||||||
|
export const EnvironmentVariable_AZURE_USERNAME: string = 'AZURE_SQL_USERNAME';
|
||||||
|
export const EnvironmentVariable_AZURE_PASSWORD: string = 'AZURE_SQL_PWD';
|
||||||
|
export const EnvironmentVariable_PYTHON_PATH: string = 'PYTHON_TEST_PATH';
|
||||||
|
|
||||||
export class TestServerProfile {
|
export class TestServerProfile {
|
||||||
constructor(private _profile: ITestServerProfile) { }
|
constructor(private _profile: ITestServerProfile) { }
|
||||||
public get serverName(): string { return this._profile.serverName; }
|
public get serverName(): string { return this._profile.serverName; }
|
||||||
@@ -54,18 +77,42 @@ export class TestServerProfile {
|
|||||||
public get authenticationType(): AuthenticationType { return this._profile.authenticationType; }
|
public get authenticationType(): AuthenticationType { return this._profile.authenticationType; }
|
||||||
public get authenticationTypeName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).name; }
|
public get authenticationTypeName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).name; }
|
||||||
public get authenticationTypeDisplayName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).displayName; }
|
public get authenticationTypeDisplayName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).displayName; }
|
||||||
|
public get engineType(): EngineType { return this._profile.engineType; }
|
||||||
}
|
}
|
||||||
|
|
||||||
var TestingServers: TestServerProfile[] = [
|
var TestingServers: TestServerProfile[] = [
|
||||||
new TestServerProfile(
|
new TestServerProfile(
|
||||||
{
|
{
|
||||||
serverName: 'SQLTOOLS2017-3',
|
serverName: getConfigValue(EnvironmentVariable_STANDALONE_SERVER),
|
||||||
userName: '',
|
userName: getConfigValue(EnvironmentVariable_STANDALONE_USERNAME),
|
||||||
password: '',
|
password: getConfigValue(EnvironmentVariable_STANDALONE_PASSWORD),
|
||||||
authenticationType: AuthenticationType.Windows,
|
authenticationType: AuthenticationType.SqlLogin,
|
||||||
database: 'master',
|
database: 'master',
|
||||||
provider: ConnectionProvider.SQLServer,
|
provider: ConnectionProvider.SQLServer,
|
||||||
version: '2017'
|
version: '2017',
|
||||||
|
engineType: EngineType.Standalone
|
||||||
|
}),
|
||||||
|
new TestServerProfile(
|
||||||
|
{
|
||||||
|
serverName: getConfigValue(EnvironmentVariable_AZURE_SERVER),
|
||||||
|
userName: getConfigValue(EnvironmentVariable_AZURE_USERNAME),
|
||||||
|
password: getConfigValue(EnvironmentVariable_AZURE_PASSWORD),
|
||||||
|
authenticationType: AuthenticationType.SqlLogin,
|
||||||
|
database: 'master',
|
||||||
|
provider: ConnectionProvider.SQLServer,
|
||||||
|
version: '2012',
|
||||||
|
engineType: EngineType.Azure
|
||||||
|
}),
|
||||||
|
new TestServerProfile(
|
||||||
|
{
|
||||||
|
serverName: getConfigValue(EnvironmentVariable_BDC_SERVER),
|
||||||
|
userName: getConfigValue(EnvironmentVariable_BDC_USERNAME),
|
||||||
|
password: getConfigValue(EnvironmentVariable_BDC_PASSWORD),
|
||||||
|
authenticationType: AuthenticationType.SqlLogin,
|
||||||
|
database: 'master',
|
||||||
|
provider: ConnectionProvider.SQLServer,
|
||||||
|
version: '2019',
|
||||||
|
engineType: EngineType.BigDataCluster
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -78,9 +125,19 @@ function getEnumMappingEntry(mapping: any, enumValue: any): INameDisplayNamePair
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getDefaultTestingServer(): Promise<TestServerProfile> {
|
export async function getAzureServer(): Promise<TestServerProfile> {
|
||||||
let servers = await getTestingServers();
|
let servers = await getTestingServers();
|
||||||
return servers[0];
|
return servers.filter(s => s.engineType === EngineType.Azure)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getStandaloneServer(): Promise<TestServerProfile> {
|
||||||
|
let servers = await getTestingServers();
|
||||||
|
return servers.filter(s => s.version === '2017' && s.engineType === EngineType.Standalone)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getBdcServer(): Promise<TestServerProfile> {
|
||||||
|
let servers = await getTestingServers();
|
||||||
|
return servers.filter(s => s.version === '2019' && s.engineType === EngineType.BigDataCluster)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getTestingServers(): Promise<TestServerProfile[]> {
|
export async function getTestingServers(): Promise<TestServerProfile[]> {
|
||||||
|
|||||||
Reference in New Issue
Block a user