-
-
Notifications
You must be signed in to change notification settings - Fork 21
status check support with logical AND #1418
Copy link
Copy link
Closed
Labels
Description
currently each status check is evaluated separately and we perform a logical OR on all the status check to evaluate the final state of test
buildtest/buildtest/builders/base.py
Lines 1052 to 1076 in 6458ab8
| state = any( | |
| [ | |
| returncode_match, | |
| regex_match, | |
| file_regex_match, | |
| slurm_job_state_match, | |
| pbs_job_state_match, | |
| lsf_job_state_match, | |
| runtime_match, | |
| assert_ge_match, | |
| assert_le_match, | |
| assert_gt_match, | |
| assert_lt_match, | |
| assert_eq_match, | |
| assert_ne_match, | |
| assert_range_match, | |
| assert_contains_match, | |
| assert_notcontains_match, | |
| assert_is_symlink, | |
| assert_exists, | |
| assert_is_dir, | |
| assert_is_file, | |
| assert_file_count, | |
| ] | |
| ) |
What we need is an option to control between logical OR or AND operation we could do this by adding a property let's say mode which could be an optional field. Valid values are [or, and]. If field is not specified we will assume or. In the following test, we perform status check with returncode and file_exists. The first test will fail while second test will pass. Note both test do the example same assertion except for the field mode.
buildspecs:
status_check_logical_and:
type: script
executor: generic.local.bash
description: logical and assertion on status check
run: mkdir foo
status:
mode: 'and'
returncode: 1
file_exists:
- foo
status_check_logical_or:
type: script
executor: generic.local.bash
description: logical and assertion on status check
run: mkdir foo
status:
mode: 'or'
returncode: 1
file_exists:
- foo Reactions are currently unavailable