Skip to content

Commit f3b9a5f

Browse files
committed
🧪 tests: update failed testcase.
1 parent 9fe8c7d commit f3b9a5f

1 file changed

Lines changed: 106 additions & 41 deletions

File tree

tests/test_job_exec.py

Lines changed: 106 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -283,59 +283,124 @@ def test_job_exec_py_fail_fast_raise_catch():
283283
.execute(params={})
284284
)
285285
assert rs.status == FAILED
286-
assert exclude_info(rs.context) == {
287-
"status": FAILED,
288-
"2150810470": {
286+
possible = []
287+
try:
288+
assert exclude_info(rs.context) == {
289289
"status": FAILED,
290-
"matrix": {"sleep": "1"},
291-
"stages": {
292-
"raise-error": {
293-
"outputs": {},
294-
"errors": {
295-
"name": "ValueError",
296-
"message": "Testing raise error inside PyStage with the sleep not equal 4!!!",
297-
},
298-
"status": FAILED,
299-
}
290+
"2150810470": {
291+
"status": FAILED,
292+
"matrix": {"sleep": "1"},
293+
"stages": {
294+
"raise-error": {
295+
"outputs": {},
296+
"errors": {
297+
"name": "ValueError",
298+
"message": "Testing raise error inside PyStage with the sleep not equal 4!!!",
299+
},
300+
"status": FAILED,
301+
}
302+
},
303+
"errors": {
304+
"name": "JobError",
305+
"message": "Strategy execution was break because its nested-stage, 'raise-error', failed.",
306+
},
300307
},
301-
"errors": {
302-
"name": "JobError",
303-
"message": "Strategy execution was break because its nested-stage, 'raise-error', failed.",
308+
"1067561285": {
309+
"status": CANCEL,
310+
"matrix": {"sleep": "2"},
311+
"stages": {},
312+
"errors": {
313+
"name": "JobCancelError",
314+
"message": "Strategy execution was canceled from the event before start stage execution.",
315+
},
304316
},
305-
},
306-
"1067561285": {
307-
"status": CANCEL,
308-
"matrix": {"sleep": "2"},
309-
"stages": {},
310-
"errors": {
311-
"name": "JobCancelError",
312-
"message": "Strategy execution was canceled from the event before start stage execution.",
317+
"9112472804": {
318+
"status": CANCEL,
319+
"matrix": {"sleep": "4"},
320+
"stages": {},
321+
"errors": {
322+
"name": "JobCancelError",
323+
"message": "Strategy execution was canceled from the event before start stage execution.",
324+
},
313325
},
314-
},
315-
"9112472804": {
316-
"status": CANCEL,
317-
"matrix": {"sleep": "4"},
318-
"stages": {},
319326
"errors": {
320-
"name": "JobCancelError",
321-
"message": "Strategy execution was canceled from the event before start stage execution.",
327+
"2150810470": {
328+
"name": "JobError",
329+
"message": "Strategy execution was break because its nested-stage, 'raise-error', failed.",
330+
},
331+
"1067561285": {
332+
"name": "JobCancelError",
333+
"message": "Strategy execution was canceled from the event before start stage execution.",
334+
},
335+
"9112472804": {
336+
"name": "JobCancelError",
337+
"message": "Strategy execution was canceled from the event before start stage execution.",
338+
},
322339
},
323-
},
324-
"errors": {
340+
}
341+
possible.append(True)
342+
except AssertionError:
343+
possible.append(False)
344+
try:
345+
assert exclude_info(rs.context) == {
346+
"status": FAILED,
325347
"2150810470": {
326-
"name": "JobError",
327-
"message": "Strategy execution was break because its nested-stage, 'raise-error', failed.",
348+
"status": FAILED,
349+
"matrix": {"sleep": "1"},
350+
"stages": {
351+
"raise-error": {
352+
"outputs": {},
353+
"errors": {
354+
"name": "ValueError",
355+
"message": "Testing raise error inside PyStage with the sleep not equal 4!!!",
356+
},
357+
"status": FAILED,
358+
}
359+
},
360+
"errors": {
361+
"name": "JobError",
362+
"message": "Strategy execution was break because its nested-stage, 'raise-error', failed.",
363+
},
328364
},
329365
"1067561285": {
330-
"name": "JobCancelError",
331-
"message": "Strategy execution was canceled from the event before start stage execution.",
366+
"status": CANCEL,
367+
"matrix": {"sleep": "2"},
368+
"stages": {},
369+
"errors": {
370+
"name": "JobCancelError",
371+
"message": "Strategy execution was canceled from the event after end stage execution.",
372+
},
332373
},
333374
"9112472804": {
334-
"name": "JobCancelError",
335-
"message": "Strategy execution was canceled from the event before start stage execution.",
375+
"status": CANCEL,
376+
"matrix": {"sleep": "4"},
377+
"stages": {},
378+
"errors": {
379+
"name": "JobCancelError",
380+
"message": "Strategy execution was canceled from the event before start stage execution.",
381+
},
336382
},
337-
},
338-
}
383+
"errors": {
384+
"2150810470": {
385+
"name": "JobError",
386+
"message": "Strategy execution was break because its nested-stage, 'raise-error', failed.",
387+
},
388+
"1067561285": {
389+
"name": "JobCancelError",
390+
"message": "Strategy execution was canceled from the event after end stage execution.",
391+
},
392+
"9112472804": {
393+
"name": "JobCancelError",
394+
"message": "Strategy execution was canceled from the event before start stage execution.",
395+
},
396+
},
397+
}
398+
possible.append(True)
399+
except AssertionError:
400+
possible.append(False)
401+
if not any(possible):
402+
print(rs.context)
403+
raise AssertionError("checking context does not match any case.")
339404

340405

341406
def test_job_exec_py_complete():

0 commit comments

Comments
 (0)