Add unit test for ray cluster-dump (#14389)

This commit is contained in:
Kai Fricke 2021-02-26 23:40:09 +01:00 committed by GitHub
parent f9364b1d5c
commit b1d0aa9798
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

View file

@ -443,5 +443,29 @@ def test_ray_status():
_check_output_via_pattern("test_ray_status.txt", result_env_arg)
@pytest.mark.skipif(
sys.platform == "darwin" and "travis" in os.environ.get("USER", ""),
reason=("Mac builds don't provide proper locale support"))
@mock_ec2
@mock_iam
def test_ray_cluster_dump(configure_lang, configure_aws, _unlink_test_ssh_key):
def commands_mock(command, stdin):
print("This is a test!")
return PopenBehaviour(stdout=b"This is a test!")
with _setup_popen_mock(commands_mock):
runner = CliRunner()
result = runner.invoke(scripts.up, [
DEFAULT_TEST_CONFIG_PATH, "--no-config-cache", "-y",
"--log-style=pretty", "--log-color", "False"
])
_die_on_error(result)
result = runner.invoke(scripts.cluster_dump,
[DEFAULT_TEST_CONFIG_PATH, "--no-processes"])
_check_output_via_pattern("test_ray_cluster_dump.txt", result)
if __name__ == "__main__":
sys.exit(pytest.main(["-v", __file__]))

View file

@ -0,0 +1,16 @@
You are about to create a cluster dump\. This will collect data from cluster nodes\.
The dump will contain this information:
- The logfiles of your Ray session
This usually includes Python outputs \(stdout/stderr\)
- Debug state information on your Ray cluster
e\.g\. number of workers, drivers, objects, etc\.
- Your installed Python packages \(`pip freeze`\)
If you are concerned about leaking private information, extract the archive and inspect its contents before sharing it with anyone\.
Retrieving cluster information from ray cluster file: .+
Checking AWS environment settings
Collecting data from remote node: .+
This is a test!
Created archive: .+