waft.framework_unit_tests.test_cli.test_vm_cli_e2e module

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.assert_command_fails(result, command_name: str) None

Helper to verify commands properly fail for errors.

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.assert_vm_inspect_success(system_name: str, config_file: str, system_param: str = '-@') None

Helper to run VM inspect and verify it succeeds with health checks.

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.create_test_vm(vm_image: str, system_name: str, config_file: str, **kwargs) None

Helper to create VM with optional parameters.

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.destroy_test_vm(system_name: str, config_file: str, system_param: str = '-@') None

Helper to destroy VM and verify success.

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.get_config_json(config_file: str) dict

Retrieve the current config as a JSON object.

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.get_systems_dict(config_file: str) dict

Helper to get systems as a name-indexed dictionary.

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.normalize_output(output: str) str

Normalize output for multi-line error message matching.

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.run_cli_command(command: list[str], config_file: str) Result

Run a CLI command with config file.

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.test_vm_auto_generated_system_name_collision_detection(waft_env)

Test collision detection when auto-generated system name matches existing config entry.

Command scenarios tested: 1. Manually add system with name ‘ubuntu_22_04_multiarch_intel’ to config 2. waft vm create ubuntu_22_04_multiarch_intel –config {config_file} (should fail)

Verifies: - Auto-generated system names (using VM spec as name) detect collisions - Error message suggests using –force flag to override - Collision detection works when system name matches VM spec name

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.test_vm_full_lifecycle_with_config_tracking(waft_env)

Test the full lifecycle of a VM and verify config file changes.

Command scenarios tested: 1. waft vm create ubuntu_22_04_multiarch_intel -@ {system_name} –config {config_file} 2. waft vm inspect -@ {system_name} –config {config_file} 3. waft vm destroy -@ {system_name} –config {config_file}

Verifies: - VM creation adds system and auto-discovers proxy in config - Inspect command shows healthy VM with SSH connectivity - Destroy command clears hostname but preserves system config

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.test_vm_images_command(waft_env)

Test the vm images command to list available VM specifications.

Command scenarios tested: 1. waft vm images

Verifies: - Images command lists available VM specifications - Output contains expected VM specs like ubuntu_22_04_multiarch_intel - Command succeeds without requiring config file

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.test_vm_invalid_vm_spec_fails_fast(waft_env)

Ensure creating a VM with an invalid spec fails fast with a clear error.

Command scenarios tested: 1. waft vm create this_spec_does_not_exist -@ {system_name}-invalid –config {config_file} (should fail)

Verifies: - Invalid VM specifications are rejected immediately - Error message clearly indicates the invalid spec name - Command fails fast without attempting Terraform operations

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.test_vm_negative_scenarios(waft_env)

Test negative scenarios and error handling.

Command scenarios tested: 1. waft vm create invalid_vm_image -@ {system_name} –config {config_file} (should fail) 2. waft vm inspect -@ nonexistent-system –config {config_file} (should fail) 3. waft vm destroy -@ nonexistent-system –config {config_file} (should fail) 4. waft vm delete -@ nonexistent-system –config {config_file} (should fail) 5. waft vm redeploy -@ nonexistent-system –config {config_file} (should fail) 6. waft vm inspect –config {config_file} (should fail - missing system)

Verifies: - All commands properly fail with appropriate error messages - Invalid VM specs are rejected - Non-existent systems are handled gracefully

waft.framework_unit_tests.test_cli.test_vm_cli_e2e.waft_env(tmp_path: Path) Generator[dict, None, None]

Set up a temporary WAFT environment for testing.