forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI][Bisect][4] Add pre-sanity check to avoid infra or external chang…
…e root causes (ray-project#34553) Why are these changes needed? Many time tests can fail due to a non-code-change issue (external or infra issues). Before running a bisect, run a pre-sanity check to make sure that the provided passing and failing revision is valid. Otherwise, terminate bisect early and let the users know that the test is flaky. Signed-off-by: elliottower <[email protected]>
- Loading branch information
1 parent
fa30fff
commit a6deb57
Showing
2 changed files
with
119 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,36 @@ | ||
from unittest import mock | ||
from typing import List, Dict | ||
from ray_release.scripts.ray_bisect import _bisect | ||
from ray_release.config import Test | ||
|
||
|
||
def test_bisect(): | ||
test_cases = { | ||
"c3": { | ||
"c0": True, | ||
"c1": True, | ||
"c3": False, | ||
"c4": False, | ||
"c0": "passed", | ||
"c1": "passed", | ||
"c3": "hard_failed", | ||
"c4": "soft_failed", | ||
}, | ||
"c1": { | ||
"c0": True, | ||
"c1": False, | ||
"c0": "passed", | ||
"c1": "hard_failed", | ||
"c2": "hard_failed", | ||
}, | ||
"cc1": { | ||
"cc0": "passed", | ||
"cc1": "hard_failed", | ||
}, | ||
} | ||
|
||
for output, input in test_cases.items(): | ||
|
||
def _mock_run_test(test_name: str, commit: str) -> bool: | ||
return input[commit] | ||
def _mock_run_test(test: Test, commit: List[str]) -> Dict[str, str]: | ||
return input | ||
|
||
with mock.patch( | ||
"ray_release.scripts.ray_bisect._run_test", | ||
side_effect=_mock_run_test, | ||
), mock.patch( | ||
"ray_release.scripts.ray_bisect._get_test", | ||
return_value={}, | ||
): | ||
assert _bisect("test", list(input.keys())) == output | ||
for concurreny in range(1, 4): | ||
assert _bisect({}, list(input.keys()), concurreny) == output |