mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -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:
@@ -11,8 +11,8 @@ import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { context } from './testContext';
|
||||
import { sqlNotebookContent, writeNotebookToFile, sqlKernelMetadata, getFileName, pySparkNotebookContent, pySpark3KernelMetadata, pythonKernelMetadata, sqlNotebookMultipleCellsContent } from './notebook.util';
|
||||
import { getBdcServer } from './testConfig';
|
||||
import { connectToServer, getConfigValue, EnvironmentVariable_PYTHON_PATH } from './utils';
|
||||
import { getBdcServer, getConfigValue, EnvironmentVariable_PYTHON_PATH } from './testConfig';
|
||||
import { connectToServer } from './utils';
|
||||
import * as fs from 'fs';
|
||||
|
||||
if (context.RunTest) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { context } from './testContext';
|
||||
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 &&
|
||||
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.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
@@ -20,6 +18,7 @@ interface ITestServerProfile {
|
||||
database: string;
|
||||
provider: ConnectionProvider;
|
||||
version: string;
|
||||
engineType: EngineType;
|
||||
}
|
||||
|
||||
interface INameDisplayNamePair {
|
||||
@@ -36,6 +35,12 @@ export enum ConnectionProvider {
|
||||
SQLServer
|
||||
}
|
||||
|
||||
export enum EngineType {
|
||||
Standalone,
|
||||
Azure,
|
||||
BigDataCluster
|
||||
}
|
||||
|
||||
var connectionProviderMapping = {};
|
||||
var authenticationTypeMapping = {};
|
||||
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.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 {
|
||||
constructor(private _profile: ITestServerProfile) { }
|
||||
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 authenticationTypeName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).name; }
|
||||
public get authenticationTypeDisplayName(): string { return getEnumMappingEntry(authenticationTypeMapping, this.authenticationType).displayName; }
|
||||
public get engineType(): EngineType { return this._profile.engineType; }
|
||||
}
|
||||
|
||||
var TestingServers: TestServerProfile[] = [
|
||||
@@ -67,7 +89,8 @@ var TestingServers: TestServerProfile[] = [
|
||||
authenticationType: AuthenticationType.SqlLogin,
|
||||
database: 'master',
|
||||
provider: ConnectionProvider.SQLServer,
|
||||
version: '2017'
|
||||
version: '2017',
|
||||
engineType: EngineType.Standalone
|
||||
}),
|
||||
new TestServerProfile(
|
||||
{
|
||||
@@ -77,7 +100,8 @@ var TestingServers: TestServerProfile[] = [
|
||||
authenticationType: AuthenticationType.SqlLogin,
|
||||
database: 'master',
|
||||
provider: ConnectionProvider.SQLServer,
|
||||
version: '2012'
|
||||
version: '2012',
|
||||
engineType: EngineType.Azure
|
||||
}),
|
||||
new TestServerProfile(
|
||||
{
|
||||
@@ -87,7 +111,8 @@ var TestingServers: TestServerProfile[] = [
|
||||
authenticationType: AuthenticationType.SqlLogin,
|
||||
database: 'master',
|
||||
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> {
|
||||
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> {
|
||||
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> {
|
||||
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[]> {
|
||||
|
||||
@@ -36,18 +36,3 @@ export async function connectToServer(server: TestServerProfile, timeout: number
|
||||
export async function ensureConnectionViewOpened() {
|
||||
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';
|
||||
|
||||
Reference in New Issue
Block a user