Skip to content

Commit 9da317d

Browse files
author
Ivan Duplenskikh
committed
Assert test to fail when FF is disabled
1 parent 28f2b81 commit 9da317d

File tree

6 files changed

+600
-96
lines changed
  • Tasks
    • AppCenterDistributeV1/Tests
    • AppCenterDistributeV2/Tests
  • _generated
    • AppCenterDistributeV1/Tests
    • AppCenterDistributeV1_Node20/Tests
    • AppCenterDistributeV2/Tests
    • AppCenterDistributeV2_Node20/Tests

6 files changed

+600
-96
lines changed

Tasks/AppCenterDistributeV1/Tests/L0.ts

+112-18
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import * as path from 'path';
66
import * as assert from 'assert';
77
import * as ttm from 'azure-pipelines-task-lib/mock-test';
88

9+
function getEnvVariable(envName) {
10+
return process.env[envName] || null
11+
}
12+
913
describe('AppCenterDistribute L0 Suite', function () {
1014
const timeout = 20000;
1115

@@ -34,7 +38,12 @@ describe('AppCenterDistribute L0 Suite', function () {
3438
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
3539

3640
tr.run();
37-
assert(tr.succeeded, 'task should have succeeded');
41+
42+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
43+
assert(tr.succeeded == false, ("Should failed when FF is on."));
44+
} else {
45+
assert(tr.succeeded, 'task should have succeeded');
46+
}
3847
});
3948

4049
it('Negative path: can not upload multiple files', function () {
@@ -44,7 +53,12 @@ describe('AppCenterDistribute L0 Suite', function () {
4453
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
4554

4655
tr.run();
47-
assert(tr.failed, 'task should have failed');
56+
57+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
58+
assert(tr.succeeded == false, ("Should failed when FF is on."));
59+
} else {
60+
assert(tr.failed, 'task should have failed');
61+
}
4862
});
4963

5064
it('Negative path: failed when HTTP status is not 2xx', function () {
@@ -54,7 +68,12 @@ describe('AppCenterDistribute L0 Suite', function () {
5468
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
5569

5670
tr.run();
57-
assert(tr.succeeded, 'task should have succeeded');
71+
72+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
73+
assert(tr.succeeded == false, ("Should failed when FF is on."));
74+
} else {
75+
assert(tr.succeeded, 'task should have succeeded');
76+
}
5877
});
5978

6079
it('Negative path: cannot continue upload without symbols', function () {
@@ -64,7 +83,12 @@ describe('AppCenterDistribute L0 Suite', function () {
6483
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
6584

6685
tr.run();
67-
assert(tr.failed, 'task should have failed');
86+
87+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
88+
assert(tr.succeeded == false, ("Should failed when FF is on."));
89+
} else {
90+
assert(tr.failed, 'task should have failed');
91+
}
6892
});
6993

7094
it('Postiive path: can continue upload without symbols if variable VSMobileCenterUpload.ContinueIfSymbolsNotFound is true', function () {
@@ -74,7 +98,12 @@ describe('AppCenterDistribute L0 Suite', function () {
7498
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
7599

76100
tr.run();
77-
assert(tr.succeeded, 'task should have succeeded');
101+
102+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
103+
assert(tr.succeeded == false, ("Should failed when FF is on."));
104+
} else {
105+
assert(tr.succeeded, 'task should have succeeded');
106+
}
78107
});
79108

80109
it('Negative path: mobile center api rejects fail the task', function () {
@@ -84,7 +113,12 @@ describe('AppCenterDistribute L0 Suite', function () {
84113
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
85114

86115
tr.run();
87-
assert(tr.failed, 'task should have failed');
116+
117+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
118+
assert(tr.succeeded == false, ("Should failed when FF is on."));
119+
} else {
120+
assert(tr.failed, 'task should have failed');
121+
}
88122
});
89123

90124
it('Positive path: single file with Include Parent', function () {
@@ -94,7 +128,12 @@ describe('AppCenterDistribute L0 Suite', function () {
94128
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
95129

96130
tr.run();
97-
assert(tr.succeeded, 'task should have succeeded');
131+
132+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
133+
assert(tr.succeeded == false, ("Should failed when FF is on."));
134+
} else {
135+
assert(tr.succeeded, 'task should have succeeded');
136+
}
98137
});
99138

100139
it('Positive path: multiple dSYMs in the same folder', function () {
@@ -104,7 +143,12 @@ describe('AppCenterDistribute L0 Suite', function () {
104143
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
105144

106145
tr.run();
107-
assert(tr.succeeded, 'task should have succeeded');
146+
147+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
148+
assert(tr.succeeded == false, ("Should failed when FF is on."));
149+
} else {
150+
assert(tr.succeeded, 'task should have succeeded');
151+
}
108152
});
109153

110154
it('Positive path: multiple dSYMs in parallel folders', function () {
@@ -114,7 +158,12 @@ describe('AppCenterDistribute L0 Suite', function () {
114158
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
115159

116160
tr.run();
117-
assert(tr.succeeded, 'task should have succeeded');
161+
162+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
163+
assert(tr.succeeded == false, ("Should failed when FF is on."));
164+
} else {
165+
assert(tr.succeeded, 'task should have succeeded');
166+
}
118167
});
119168

120169
it('Positive path: multiple dSYMs in a tree', function () {
@@ -124,7 +173,12 @@ describe('AppCenterDistribute L0 Suite', function () {
124173
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
125174

126175
tr.run();
127-
assert(tr.succeeded, 'task should have succeeded');
176+
177+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
178+
assert(tr.succeeded == false, ("Should failed when FF is on."));
179+
} else {
180+
assert(tr.succeeded, 'task should have succeeded');
181+
}
128182
});
129183

130184
it('Positive path: a single dSYM', function () {
@@ -134,7 +188,12 @@ describe('AppCenterDistribute L0 Suite', function () {
134188
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
135189

136190
tr.run();
137-
assert(tr.succeeded, 'task should have succeeded');
191+
192+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
193+
assert(tr.succeeded == false, ("Should failed when FF is on."));
194+
} else {
195+
assert(tr.succeeded, 'task should have succeeded');
196+
}
138197
});
139198

140199
it('Positive path: a single PDB', function () {
@@ -144,7 +203,12 @@ describe('AppCenterDistribute L0 Suite', function () {
144203
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
145204

146205
tr.run();
147-
assert(tr.succeeded, 'task should have succeeded');
206+
207+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
208+
assert(tr.succeeded == false, ("Should failed when FF is on."));
209+
} else {
210+
assert(tr.succeeded, 'task should have succeeded');
211+
}
148212
});
149213

150214

@@ -155,7 +219,12 @@ describe('AppCenterDistribute L0 Suite', function () {
155219
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
156220

157221
tr.run();
158-
assert(tr.succeeded, 'task should have succeeded');
222+
223+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
224+
assert(tr.succeeded == false, ("Should failed when FF is on."));
225+
} else {
226+
assert(tr.succeeded, 'task should have succeeded');
227+
}
159228
});
160229

161230
it('Positive path: publish commit info (including commit message)', function () {
@@ -165,7 +234,12 @@ describe('AppCenterDistribute L0 Suite', function () {
165234
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
166235

167236
tr.run();
168-
assert(tr.succeeded, 'task should have succeeded');
237+
238+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
239+
assert(tr.succeeded == false, ("Should failed when FF is on."));
240+
} else {
241+
assert(tr.succeeded, 'task should have succeeded');
242+
}
169243
});
170244

171245
it('Positive path: publish commit info (excluding commit message)', function () {
@@ -175,7 +249,12 @@ describe('AppCenterDistribute L0 Suite', function () {
175249
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
176250

177251
tr.run();
178-
assert(tr.succeeded, 'task should have succeeded');
252+
253+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
254+
assert(tr.succeeded == false, ("Should failed when FF is on."));
255+
} else {
256+
assert(tr.succeeded, 'task should have succeeded');
257+
}
179258
});
180259

181260
it('Positive path: publish commit info for feature branch', function () {
@@ -185,7 +264,12 @@ describe('AppCenterDistribute L0 Suite', function () {
185264
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
186265

187266
tr.run();
188-
assert(tr.succeeded, 'task should have succeeded');
267+
268+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
269+
assert(tr.succeeded == false, ("Should failed when FF is on."));
270+
} else {
271+
assert(tr.succeeded, 'task should have succeeded');
272+
}
189273
});
190274

191275
it('Positive path: publish commit info for tfvc branch', function () {
@@ -195,7 +279,12 @@ describe('AppCenterDistribute L0 Suite', function () {
195279
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
196280

197281
tr.run();
198-
assert(tr.succeeded, 'task should have succeeded');
282+
283+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
284+
assert(tr.succeeded == false, ("Should failed when FF is on."));
285+
} else {
286+
assert(tr.succeeded, 'task should have succeeded');
287+
}
199288
});
200289

201290
it('Positive path: publish mandatory update', function () {
@@ -205,6 +294,11 @@ describe('AppCenterDistribute L0 Suite', function () {
205294
let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp);
206295

207296
tr.run();
208-
assert(tr.succeeded, 'task should have succeeded');
297+
298+
if (Boolean(getEnvVariable('FAIL_DEPRECATED_BUILD_TASK'))) {
299+
assert(tr.succeeded == false, ("Should failed when FF is on."));
300+
} else {
301+
assert(tr.succeeded, 'task should have succeeded');
302+
}
209303
});
210304
});

0 commit comments

Comments
 (0)