Repository navigation
Integ test 2 - #326
Integ test 2#326
Conversation
* feat: Implement elastic training cli arguments * Add elastic training unified config and unit test * Add graceful shutdown and scaling timeout to cli args
This reverts commit 18428ef.
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space.py CLI command * Add dev space unit tests --------- Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add dev_space_utils.py * Add unit tests for dev_space_utils --------- Co-authored-by: Brian Xia <brianxia@amazon.com>
* Add space_admin_config.py CLI command * Update the space admin config to space template --------- Co-authored-by: Brian Xia <brianxia@amazon.com>
* Implement CRUD operations for Space PySDK * Update Space PySDK per new schema * Update Space PySDK per new schema
* Implement CRUD operations for Space PySDK * Update Space PySDK per new schema * Refactor CLI to use the PySDK
* Add dev_space_access.py CLI command * Add space access creation to pySDK and refactor space access CLI --------- Co-authored-by: Brian Xia <brianxia@amazon.com>
…ser (#285) * Implement CRUD operations for Space PySDK * Update Space PySDK per new schema * Implement CRUD operations for Space PySDK * Update Space PySDK per new schema * Update Space PySDK per new schema * Implement space list pagination and creator filtering
* Implement validation for mig profiles when creating/updating spaces * Update Space parameter model * Make Space Template namespaced resource
* Update Space Template CLI to be namespaced * Space get-logs default to the workspace container * Remove error handling to bubble up the actual K8s errors * Listing public Spaces * Fix typos, elaborated text, add logic to parse idle-shutdown
Inference tests succeeded with parker-cli code - https://quip-amazon.com/fhwhAAMht0Mm/Project-Parker-HyperPod-User-Experience-for-Data-Scientist-persona Parker-cli integ tests pass (shown below) These inference tests failing are known to be flaky- https://w.amazon.com/bin/view/AWS/AmazonAI/Platform/Codex/CodexInfra/Runbooks/HyperPodCLI/TroubleshootInferenceTests#HTroubleshooting ticket has been created to fix these flaky tests - https://t.corp.amazon.com/V1943878058 Parker-cli integ tests passing ============================= test session starts ============================== platform linux -- Python 3.11.14, pytest-8.3.2, pluggy-1.6.0 -- /root/.pyenv/versions/3.11.14/bin/python3.11 cachedir: .pytest_cache rootdir: /codebuild/output/src1458832038/src/github.com/aws/private-sagemaker-hyperpod-cli-staging configfile: setup.cfg plugins: hydra-core-1.3.2, order-1.3.0, dependency-0.6.0, cov-5.0.0 collecting ... collected 39 items test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_create PASSED [ 2%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_table PASSED [ 5%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_json PASSED [ 7%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_yaml PASSED [ 10%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_json PASSED [ 12%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_stop PASSED [ 15%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_start PASSED [ 17%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_update PASSED [ 20%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_get_logs PASSED [ 23%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete PASSED [ 25%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_list_empty_namespace PASSED [ 28%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_describe_nonexistent PASSED [ 30%] test/integration_tests/space/cli/test_cli_space.py::TestSpaceCLI::test_space_delete_nonexistent PASSED [ 33%] test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_create PASSED [ 35%] test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_table PASSED [ 38%] test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_json PASSED [ 41%] test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_yaml PASSED [ 43%] test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_json PASSED [ 46%] test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_update PASSED [ 48%] test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete PASSED [ 51%] test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_list_empty_namespace PASSED [ 53%] test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_describe_nonexistent PASSED [ 56%] test/integration_tests/space/cli/test_cli_space_template.py::TestSpaceTemplateCLI::test_space_template_delete_nonexistent PASSED [ 58%] test/integration_tests/space/sdk/test_sdk_space.py::test_create_space PASSED [ 61%] test/integration_tests/space/sdk/test_sdk_space.py::test_list_spaces PASSED [ 64%] test/integration_tests/space/sdk/test_sdk_space.py::test_get_space PASSED [ 66%] test/integration_tests/space/sdk/test_sdk_space.py::test_wait_until_running PASSED [ 69%] test/integration_tests/space/sdk/test_sdk_space.py::test_update_space PASSED [ 71%] test/integration_tests/space/sdk/test_sdk_space.py::test_stop_space PASSED [ 74%] test/integration_tests/space/sdk/test_sdk_space.py::test_start_space PASSED [ 76%] test/integration_tests/space/sdk/test_sdk_space.py::test_list_pods PASSED [ 79%] test/integration_tests/space/sdk/test_sdk_space.py::test_get_logs PASSED [ 82%] test/integration_tests/space/sdk/test_sdk_space.py::test_create_space_access SKIPPED [ 84%] test/integration_tests/space/sdk/test_sdk_space.py::test_delete_space PASSED [ 87%] test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_create_template PASSED [ 89%] test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_list_templates PASSED [ 92%] test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_get_template PASSED [ 94%] test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_update_template PASSED [ 97%] test/integration_tests/space/sdk/test_sdk_space_template.py::TestHPSpaceTemplate::test_delete_template PASSED [100%] =============================== warnings summary ===============================
* Update README for fractional gpu support * update pytorch job example * add example for accelerator partitions
| ]) | ||
|
|
||
| assert result.exit_code == 0 | ||
| assert "https://test-url.com" in result.output |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 year ago
To fix this issue, we should avoid substring checks on potentially variable or sanitized output, and instead, compare more structured output. The best way is to parse the output and extract the URL, then compare it directly to the expected URL. If the output is known to be the URL itself, then checking for equality is sufficient. If the output contains additional text, then use a regex or parse the line containing the URL to isolate it, then perform an equality check.
In the provided code, if result.output contains only the URL, you can use assert result.output.strip() == "https://test-url.com". If it contains more, extract the URL before asserting. Make similar adjustments for line 51 for consistency.
We need to import re or use string parsing as appropriate. Modifications are to be made in test/unit_tests/cli/test_space_access.py in the two test methods, updating lines 32 and 51. No new methods are needed; standard library suffices.
| @@ -29,7 +29,10 @@ | ||
| ]) | ||
|
|
||
| assert result.exit_code == 0 | ||
| assert "https://test-url.com" in result.output | ||
| import re | ||
| url_match = re.search(r"https://[^\s]+", result.output) | ||
| assert url_match is not None | ||
| assert url_match.group(0) == "https://test-url.com" | ||
| mock_hp_space_class.get.assert_called_once_with(name='test-space', namespace='test-namespace') | ||
| mock_space_instance.create_space_access.assert_called_once_with(connection_type='vscode-remote') | ||
|
|
||
| @@ -48,6 +51,9 @@ | ||
| ]) | ||
|
|
||
| assert result.exit_code == 0 | ||
| assert "https://default-url.com" in result.output | ||
| import re | ||
| url_match = re.search(r"https://[^\s]+", result.output) | ||
| assert url_match is not None | ||
| assert url_match.group(0) == "https://default-url.com" | ||
| mock_hp_space_class.get.assert_called_once_with(name='test-space', namespace='default') | ||
| mock_space_instance.create_space_access.assert_called_once_with(connection_type='vscode-remote') |
| ]) | ||
|
|
||
| assert result.exit_code == 0 | ||
| assert "https://default-url.com" in result.output |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization
Copilot Autofix
AI about 1 year ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
What's changing and why?
Before/After UX
Before:
After:
How was this change tested?
Are unit tests added?
Are integration tests added?
Reviewer Guidelines
One of the following must be true: