Skip to content

Commit 9a8b216

Browse files
authored
Bump task lib in ABTT tasks. Part 2 (#20294)
* Update bashV3 * Update CmdlineV2 task * add typescript 4.9.5 to allowed versions * Update tasks npm update script * Update BashV3 * Update CMakeV1 task * Update DecryptFileV1 * Update CocoaPodsV0 * Update CUrlUploaderV2 * Update CondaEnvironmentV0 * Update CondaEnvironmentV1 * Update CopyFilesOverSSHV0 * Update cmakeV1 gen files * Fix bashV3 tests * Update BashV3 tests * Add test validator for CondaEnvironmentV1 * Fix tests in CondaEnvironmentV1 * rebump cmdlinev2
1 parent 569ba09 commit 9a8b216

File tree

191 files changed

+7589
-11084
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+7589
-11084
lines changed

Tasks/BashV3/Tests/L0.ts

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,38 @@ import { runValidateFileArgsTests } from './L0ValidateFileArgs';
77
describe('Bash Suite', function () {
88
this.timeout(parseInt(process.env.TASK_TEST_TIMEOUT) || 80000);
99

10-
function runValidations(validator: () => void, tr, done) {
10+
function runValidations(validator: () => void, tr: ttm.MockTestRunner) {
1111
try {
1212
validator();
13-
done();
1413
}
1514
catch (error) {
1615
console.log("STDERR", tr.stderr);
1716
console.log("STDOUT", tr.stdout);
18-
done(error);
17+
throw error;
1918
}
2019
}
2120

22-
it('Runs an inline script correctly', (done: Mocha.Done) => {
21+
it('Runs an inline script correctly', async () => {
2322
delete process.env['AZP_BASHV3_OLD_SOURCE_BEHAVIOR'];
2423
let tp: string = path.join(__dirname, 'L0Inline.js');
2524
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
2625

27-
tr.run();
26+
await tr.runAsync();
2827

2928
runValidations(() => {
3029
assert(tr.succeeded, 'Bash should have succeeded.');
3130
assert(tr.stderr.length === 0, 'Bash should not have written to stderr');
3231
assert(tr.stdout.indexOf('my script output') > 0, 'Bash should have correctly run the script');
33-
}, tr, done);
32+
}, tr);
3433
});
3534

36-
it('Runs a checked in script correctly', (done: Mocha.Done) => {
35+
it('Runs a checked in script correctly', async () => {
3736
delete process.env['AZP_BASHV3_OLD_SOURCE_BEHAVIOR'];
3837
process.env['AZP_TASK_FF_BASHV3_ENABLE_SECURE_ARGS'] = 'false'
3938
let tp: string = path.join(__dirname, 'L0External.js');
4039
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
4140

42-
tr.run();
41+
await tr.runAsync();
4342

4443
runValidations(() => {
4544
assert(tr.succeeded, 'Bash should have succeeded.');
@@ -52,16 +51,16 @@ describe('Bash Suite', function () {
5251
}
5352

5453
assert(tr.stdout.indexOf('my script output') > 0, 'Bash should have correctly run the script');
55-
}, tr, done);
54+
}, tr);
5655
});
5756

58-
it('Runs a checked in script correctly when using the old behavior', (done: Mocha.Done) => {
57+
it('Runs a checked in script correctly when using the old behavior', async () => {
5958
process.env['AZP_BASHV3_OLD_SOURCE_BEHAVIOR'] = "true";
6059
process.env['AZP_TASK_FF_BASHV3_ENABLE_SECURE_ARGS'] = 'false'
6160
let tp: string = path.join(__dirname, 'L0External.js');
6261
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
6362

64-
tr.run();
63+
await tr.runAsync();
6564

6665
runValidations(() => {
6766
assert(tr.succeeded, 'Bash should have succeeded.');
@@ -74,16 +73,16 @@ describe('Bash Suite', function () {
7473
}
7574

7675
assert(tr.stdout.indexOf('my script output') > 0, 'Bash should have correctly run the script');
77-
}, tr, done);
76+
}, tr);
7877
});
7978

80-
it('Adds arguments to the script', (done: Mocha.Done) => {
79+
it('Adds arguments to the script', async () => {
8180
delete process.env['AZP_BASHV3_OLD_SOURCE_BEHAVIOR'];
8281
process.env['AZP_TASK_FF_BASHV3_ENABLE_SECURE_ARGS'] = 'false'
8382
let tp: string = path.join(__dirname, 'L0Args.js');
8483
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
8584

86-
tr.run();
85+
await tr.runAsync();
8786

8887
runValidations(() => {
8988
assert(tr.succeeded, 'Bash should have succeeded.');
@@ -96,59 +95,61 @@ describe('Bash Suite', function () {
9695
}
9796

9897
assert(tr.stdout.indexOf('my script output') > 0, 'Bash should have correctly run the script');
99-
}, tr, done);
98+
}, tr);
10099
});
101100

102-
it('Reports stderr correctly', (done: Mocha.Done) => {
101+
it('Reports stderr correctly', async () => {
103102
let tp: string = path.join(__dirname, 'L0StdErr.js');
104103
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
105104

106-
tr.run();
105+
await tr.runAsync();
107106

108107
runValidations(() => {
109108
assert(tr.failed, 'Bash should have failed');
110109
assert(tr.stdout.indexOf('##vso[task.issue type=error;source=CustomerScript;]myErrorTest') > 0, 'Bash should have correctly written myErrorTest');
111110
assert(tr.stdout.length > 1000, 'Bash stderr output is not truncated');
112-
}, tr, done);
111+
}, tr);
113112
});
114113

115-
it('Fails on exit code null', (done: Mocha.Done) => {
114+
it('Fails on exit code null', async () => {
116115
let tp: string = path.join(__dirname, 'L0FailOnExitCodeNull.js');
117116
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
118117

119-
tr.run();
118+
await tr.runAsync();
120119

121120
runValidations(() => {
122121
assert(tr.failed, 'Bash should have failed when the script exits with null code');
123-
}, tr, done);
122+
}, tr);
124123
});
125124

126-
it('BASH_ENV - set environment variable', (done: Mocha.Done) => {
125+
it('BASH_ENV - set environment variable', async () => {
127126
delete process.env['BASH_ENV'];
127+
process.env['SYSTEM_DEBUG'] = 'true';
128128

129129
const testPath: string = path.join(__dirname, 'L0SetBashEnv.js');
130130
const taskRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath);
131131

132-
taskRunner.run();
132+
await taskRunner.runAsync();
133133

134134
runValidations(() => {
135135
assert(taskRunner.succeeded, 'Bash should have succeeded.');
136136
assert(taskRunner.stdout.indexOf('The BASH_ENV environment variable was set to ~/.profile') > 0, 'Task should set BASH_ENV to ~/.profile');
137-
}, taskRunner, done);
137+
}, taskRunner);
138138
});
139139

140-
it('BASH_ENV - override environment variable', (done: Mocha.Done) => {
140+
it('BASH_ENV - override environment variable', async () => {
141141
process.env['BASH_ENV'] = 'some/custom/path';
142+
process.env['SYSTEM_DEBUG'] = 'true';
142143

143144
const testPath: string = path.join(__dirname, 'L0SetBashEnv.js');
144145
const taskRunner: ttm.MockTestRunner = new ttm.MockTestRunner(testPath);
145146

146-
taskRunner.run();
147+
await taskRunner.runAsync();
147148

148149
runValidations(() => {
149150
assert(taskRunner.succeeded, 'Bash should have succeeded.');
150151
assert(taskRunner.stdout.indexOf('The BASH_ENV environment variable was set to ~/.profile') > 0, 'Task should override the value of BASH_ENV with ~/.profile');
151-
}, taskRunner, done);
152+
}, taskRunner);
152153
});
153154

154155
describe('File args env processing tests', () => {

0 commit comments

Comments
 (0)