Skip to content

Commit

Permalink
@MicroCheck //python/ray/dag:test_torch_tensor_dag_gpu
Browse files Browse the repository at this point in the history
Signed-off-by: can <[email protected]>
  • Loading branch information
can-anyscale committed May 17, 2024
1 parent b7f0fec commit 319d782
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 50 deletions.
23 changes: 1 addition & 22 deletions ci/ray_ci/test_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
_get_tag_matcher,
_get_changed_files,
_get_changed_tests,
_get_human_specified_tests,
)
from ray_release.test import Test, TestState

Expand Down Expand Up @@ -215,7 +214,6 @@ def test_get_high_impact_test_targets() -> None:
{
"input": [],
"new_tests": set(),
"human_tests": set(),
"output": set(),
},
{
Expand All @@ -234,11 +232,9 @@ def test_get_high_impact_test_targets() -> None:
),
],
"new_tests": {"//core_new"},
"human_tests": {"//human_test"},
"output": {
"//core_good",
"//core_new",
"//human_test",
},
},
]
Expand All @@ -249,9 +245,6 @@ def test_get_high_impact_test_targets() -> None:
), mock.patch(
"ci.ray_ci.tester._get_changed_tests",
return_value=test["new_tests"],
), mock.patch(
"ci.ray_ci.tester._get_human_specified_tests",
return_value=test["human_tests"],
):
assert (
_get_high_impact_test_targets(
Expand All @@ -263,10 +256,7 @@ def test_get_high_impact_test_targets() -> None:
)


@mock.patch.dict(
os.environ,
{"BUILDKITE_PULL_REQUEST_BASE_BRANCH": "base", "BUILDKITE_COMMIT": "commit"},
)
@mock.patch.dict(os.environ, {"BUILDKITE_PULL_REQUEST_BASE_BRANCH": "base"})
@mock.patch("subprocess.check_call")
@mock.patch("subprocess.check_output")
def test_get_changed_files(mock_check_output, mock_check_call) -> None:
Expand All @@ -287,17 +277,6 @@ def test_get_changed_tests(
assert _get_changed_tests() == {"//t1", "//t2"}


@mock.patch.dict(
os.environ,
{"BUILDKITE_PULL_REQUEST_BASE_BRANCH": "base", "BUILDKITE_COMMIT": "commit"},
)
@mock.patch("subprocess.check_call")
@mock.patch("subprocess.check_output")
def test_get_human_specified_tests(mock_check_output, mock_check_call) -> None:
mock_check_output.return_value = b"hi\n@microcheck //test01 //test02\nthere"
assert _get_human_specified_tests() == {"//test01", "//test02"}


def test_get_flaky_test_targets() -> None:
test_harness = [
{
Expand Down
28 changes: 1 addition & 27 deletions ci/ray_ci/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
""" # noqa: E501

DEFAULT_EXCEPT_TAGS = {"manual"}
MICROCHECK_COMMAND = "@microcheck"

# Gets the path of product/tools/docker (i.e. the parent of 'common')
bazel_workspace_dir = os.environ.get("BUILD_WORKSPACE_DIRECTORY", "")
Expand Down Expand Up @@ -417,33 +416,8 @@ def _get_high_impact_test_targets(
if test.get_oncall() == team
}
changed_tests = _get_changed_tests()
human_specified_tests = _get_human_specified_tests()

return high_impact_tests.union(changed_tests).union(human_specified_tests)


def _get_human_specified_tests() -> Set[str]:
"""
Get all test targets that are specified by humans
"""
base = os.environ.get("BUILDKITE_PULL_REQUEST_BASE_BRANCH")
head = os.environ.get("BUILDKITE_COMMIT")
if not base or not head:
# if not in a PR, return an empty set
return set()

tests = set()
subprocess.check_call(["git", "fetch", "origin", base], cwd=bazel_workspace_dir)
messages = subprocess.check_output(
["git", "rev-list", "--format=%B", f"origin/{base}...{head}"],
cwd=bazel_workspace_dir,
)
for message in messages.decode().splitlines():
if message.startswith(MICROCHECK_COMMAND):
tests = tests.union(message[len(MICROCHECK_COMMAND) :].strip().split(" "))
logger.info(f"Human specified tests: {tests}")

return tests
return high_impact_tests.union(changed_tests)


def _get_changed_tests() -> Set[str]:
Expand Down
2 changes: 1 addition & 1 deletion release/ray_release/tests/test_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def gen_high_impact_tests(mock_gen_from_s3) -> None:
"name": "data_test_02",
Test.KEY_IS_HIGH_IMPACT: "true",
"test_results": [
_stub_test_result(rayci_step_id="databuild", commit="321"),
_stub_test_result(rayci_step_id="databuild", commit="789"),
],
}
)
Expand Down

0 comments on commit 319d782

Please sign in to comment.