add some unit test for resource deployment ext (#11604)

* add some unit test for resource deployment ext

* feedback & remove unused method
This commit is contained in:
Alan Ren
2020-08-04 17:18:26 -07:00
committed by GitHub
parent 0c3798ae26
commit 656d944894
5 changed files with 119 additions and 14 deletions

View File

@@ -18,7 +18,6 @@ export interface BdcEndpoint {
export interface IAzdataService {
getDeploymentProfiles(deploymentType: BdcDeploymentType): Promise<BigDataClusterDeploymentProfile[]>;
getEndpoints(clusterName: string, userName: string, password: string): Promise<BdcEndpoint[]>;
}
export class AzdataService implements IAzdataService {
@@ -73,16 +72,4 @@ export class AzdataService implements IAzdataService {
private async getJsonObjectFromFile(path: string): Promise<any> {
return JSON.parse(await this.platformService.readTextFile(path));
}
public async getEndpoints(clusterName: string, userName: string, password: string): Promise<BdcEndpoint[]> {
const env: NodeJS.ProcessEnv = {};
env['AZDATA_USERNAME'] = userName;
env['AZDATA_PASSWORD'] = password;
env['ACCEPT_EULA'] = 'yes';
let cmd = 'azdata login -n ' + clusterName;
await this.platformService.runCommand(cmd, { additionalEnvironmentVariables: env });
cmd = 'azdata bdc endpoint list';
const stdout = await this.platformService.runCommand(cmd, { additionalEnvironmentVariables: env });
return <BdcEndpoint[]>JSON.parse(stdout);
}
}