mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add tests for Jupyter Session (#12053)
* add tests for Jupyter Session * remove comment and fix description * throw error if spark kernel provider is not mssql * use localize strings and add pythonEnvVarPath test
This commit is contained in:
@@ -17,6 +17,7 @@ import { JupyterKernel } from './jupyterKernel';
|
||||
import { Deferred } from '../common/promise';
|
||||
import { JupyterServerInstallation } from './jupyterServerInstallation';
|
||||
import * as bdc from 'bdc';
|
||||
import { noBDCConnectionError, providerNotValidError } from '../common/localizedConstants';
|
||||
|
||||
const configBase = {
|
||||
'kernel_python_credentials': {
|
||||
@@ -287,7 +288,7 @@ export class JupyterSession implements nb.ISession {
|
||||
const endpoints = await this.getClusterEndpoints(connectionProfile.id);
|
||||
const gatewayEndpoint: utils.IEndpoint = endpoints?.find(ep => ep.serviceName.toLowerCase() === KNOX_ENDPOINT_GATEWAY);
|
||||
if (!gatewayEndpoint) {
|
||||
return Promise.reject(new Error(localize('connectionNotValid', "Spark kernels require a connection to a SQL Server Big Data Cluster master instance.")));
|
||||
throw new Error(noBDCConnectionError);
|
||||
}
|
||||
let gatewayHostAndPort = utils.getHostAndPortFromEndpoint(gatewayEndpoint.endpoint);
|
||||
connectionProfile.options[KNOX_ENDPOINT_SERVER] = gatewayHostAndPort.host;
|
||||
@@ -308,7 +309,7 @@ export class JupyterSession implements nb.ISession {
|
||||
}
|
||||
}
|
||||
else {
|
||||
connectionProfile.options[KNOX_ENDPOINT_PORT] = this.getKnoxPortOrDefault(connectionProfile);
|
||||
throw new Error(providerNotValidError);
|
||||
}
|
||||
this.setHostAndPort(':', connectionProfile);
|
||||
this.setHostAndPort(',', connectionProfile);
|
||||
@@ -355,14 +356,6 @@ export class JupyterSession implements nb.ISession {
|
||||
config.ignore_ssl_errors = utils.getIgnoreSslVerificationConfigSetting();
|
||||
}
|
||||
|
||||
private getKnoxPortOrDefault(connectionProfile: IConnectionProfile): string {
|
||||
let port = connectionProfile.options[KNOX_ENDPOINT_PORT];
|
||||
if (!port) {
|
||||
port = '30443';
|
||||
}
|
||||
return port;
|
||||
}
|
||||
|
||||
private async getClusterEndpoints(profileId: string): Promise<utils.IEndpoint[]> {
|
||||
let serverInfo: ServerInfo = await connection.getServerInfo(profileId);
|
||||
if (!serverInfo || !serverInfo.options) {
|
||||
|
||||
Reference in New Issue
Block a user