forked from microsoft/azure-pipelines-tasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
L0.ts
65 lines (44 loc) · 2.47 KB
/
L0.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import assert = require('assert');
import path = require('path');
import os = require('os');
import process = require('process');
import fs = require('fs');
import * as ttm from 'azure-pipelines-task-lib/mock-test';
describe('JavaToolInstaller L0 Suite', function () {
it('should fail when JavaToolInstaller is run with no azure server endpoint', function () {
this.timeout(20000);
const testPath: string = path.join(__dirname, 'L0FailsIfNoAzureEndpointSet.js');
const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath);
testRunner.run();
assert(testRunner.failed, 'task should have failed');
});
it('should run successfully when fetching JDK files from azure storage', function () {
this.timeout(20000);
const testPath: string = path.join(__dirname, 'L0DownloadsJdkFromAzureStorage.js');
const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath);
testRunner.run();
assert(testRunner.succeeded, 'task should have succeeded.');
});
it('should run successfully when fetching JDK files from azure storage from subfolder', function () {
this.timeout(20000);
const testPath: string = path.join(__dirname, 'L0DownloadsJdkFromAzureStorageSubFolder.js');
const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath);
testRunner.run();
assert((testRunner.stdOutContained('jdkFileName: DestinationDirectory\\JDKname.tar.gz') || testRunner.stdOutContained('jdkFileName: DestinationDirectory/JDKname.tar.gz')) , 'JDK archive should unpack in the right destination directory');
assert(testRunner.succeeded, 'task should have succeeded.');
});
it('should fail when JavaToolInstaller is run with to destination folder specified', function () {
this.timeout(20000);
const testPath: string = path.join(__dirname, 'L0NoDestinationFolder.js');
const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath);
testRunner.run();
assert(testRunner.failed, 'task should have failed');
});
it('should run successfully when creating a Maven Toolchains Declaration', function () {
this.timeout(20000);
const testPath: string = path.join(__dirname, 'L0MavenToolchains.js');
const testRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath);
testRunner.run();
assert(testRunner.succeeded, 'task should have succeeded.');
});
});