Skip to content

Commit 7a38a9a

Browse files
Hao Zhangclaude
andcommitted
[Test] Add comprehensive resize unit and smoke tests
Unit tests (17 total, 13 new): - Scale-up is noop in pre-provision - Same-size is noop - Scale-down rejects RUNNING, SETTING_UP, and PENDING jobs - Scale-down error message lists all in-progress job IDs - Scale-down aborts on SSH failure (safety guard) - Scale-down succeeds on idle cluster (terminates workers) - Scale-down allows completed/failed/cancelled jobs - Scale-down to 1 node (head-only) - _check_existing_cluster uses task.num_nodes when resize=True - _check_existing_cluster uses handle.launched_nodes when resize=False - _check_existing_cluster warns (not errors) for non-existent cluster - CLI --resize without -c raises UsageError Smoke tests: - Add test_resize_cli_validation: --resize without -c errors, --resize on non-existent cluster warns and creates normally Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f99daa8 commit 7a38a9a

2 files changed

Lines changed: 328 additions & 19 deletions

File tree

tests/smoke_tests/test_cluster_job.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,3 +3540,24 @@ def test_resize(generic_cloud: str):
35403540
timeout=10 * 60,
35413541
)
35423542
smoke_tests_utils.run_one_test(test)
3543+
3544+
3545+
@pytest.mark.kubernetes
3546+
def test_resize_cli_validation(generic_cloud: str):
3547+
"""Test resize CLI validation: --resize without -c should error."""
3548+
name = smoke_tests_utils.get_cluster_name()
3549+
test = smoke_tests_utils.Test(
3550+
'resize_cli_validation',
3551+
[
3552+
# --resize without -c should error.
3553+
'sky launch --resize --num-nodes 4 2>&1 && '
3554+
'exit 1 || echo "Correctly rejected"',
3555+
# --resize on a non-existent cluster should warn and create.
3556+
f'sky launch -y -c {name} --resize --infra kubernetes '
3557+
f'--cpus 2 --num-nodes 1',
3558+
f's=$(sky status {name}) && echo "$s" && echo "$s" | grep {name} | grep UP',
3559+
],
3560+
f'sky down -y {name}',
3561+
timeout=5 * 60,
3562+
)
3563+
smoke_tests_utils.run_one_test(test)

0 commit comments

Comments
 (0)