mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 02:32:35 -05:00
* add install tools button (#7454) * add install tools button * address comments * remove description for install tools hint message * First working version of AutoDeployment of tools (#7647) First working version of AutoDeployment of tools. This pull request adds feature to install the tools needed for doing BDC/TINA deployments. This has been tested so far only on win32 and testing on other platforms is in progress. * removing TODO and redundant code * Not localizing azuredatastudio product name * convert methods returning Promises to async-await * changing from null to undefined * Localize all the command labels * using existing sudo-prompt typings * progres/error status in ModalDialogue && PR fixes * review feedback to change warning to information * revert settings.json changes * fix resource-Deployment Extension Unit Test * ensuring platform service's working directory * incorporate review feedback * review feedback * addressing PR feedback * PR fixes * PR Feedback * remove debug logs * disable UI deployment containers when installing * addding data type to stdout/stderr messaging * remove commented code * revert accidental change * addressing review feedback * fix failed install with zero exit code * fixing bug due to typo * fixes for linux * Misc fixes during mac testing * PR fixes
52 lines
2.1 KiB
TypeScript
52 lines
2.1 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import 'mocha';
|
|
import assert = require('assert');
|
|
import * as TypeMoq from 'typemoq';
|
|
import { ToolsService } from '../services/toolsService';
|
|
import { ToolType } from '../interfaces';
|
|
import { isNumber } from 'util';
|
|
import { IPlatformService } from '../services/platformService';
|
|
|
|
suite('Tools Service Tests', function (): void {
|
|
|
|
test('run getToolByName with all known values', () => {
|
|
const mockPlatformService = TypeMoq.Mock.ofType<IPlatformService>();
|
|
const toolsService = new ToolsService(mockPlatformService.object);
|
|
|
|
const tools: { name: string; type: ToolType }[] = [
|
|
{ name: 'azure-cli', type: ToolType.AzCli },
|
|
{ name: 'docker', type: ToolType.Docker },
|
|
{ name: 'kubectl', type: ToolType.KubeCtl },
|
|
{ name: 'azdata', type: ToolType.Azdata }];
|
|
|
|
const missingTypes: string[] = [];
|
|
|
|
// Make sure all the enum values are covered
|
|
for (const type in ToolType) {
|
|
if (isNumber(ToolType[type])) {
|
|
if (tools.findIndex(element => element.type === parseInt(ToolType[type])) === -1) {
|
|
missingTypes.push(type);
|
|
}
|
|
}
|
|
}
|
|
assert(missingTypes.length === 0, `the following enum values are not included in the test:${missingTypes.join(',')}`);
|
|
|
|
tools.forEach(toolInfo => {
|
|
const tool = toolsService.getToolByName(toolInfo.name);
|
|
assert(!!tool, `The tool: ${toolInfo.name} is not recognized`);
|
|
assert.equal(tool!.type, toolInfo.type, 'returned notebook name does not match expected value');
|
|
});
|
|
});
|
|
|
|
test('run getToolByName with a name that is not defined', () => {
|
|
const mockPlatformService = TypeMoq.Mock.ofType<IPlatformService>();
|
|
const toolsService = new ToolsService(mockPlatformService.object);
|
|
const tool = toolsService.getToolByName('no-such-tool');
|
|
assert(tool === undefined, 'for a not defined tool, expected value is undefined');
|
|
});
|
|
});
|