test(vm_extensions): add CustomScript boot validation test case#4580
test(vm_extensions): add CustomScript boot validation test case#4580Jape96 wants to merge 2 commits into
Conversation
Add a minimal, self-contained Custom Script extension boot validation test to CustomScriptTests. It installs the extension with a single inline commandToExecute (no fileUris, so no storage account or public blob is required), asserts provisioning succeeds, then removes the extension. Publisher, type and version are read from runbook variables (extension_publisher, extension_type, extension_version), defaulting to the Custom Script extension. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new, minimal Custom Script VM extension “boot validation” test to the existing CustomScriptTests suite to validate that installing the extension with only an inline commandToExecute succeeds (no fileUris / storage dependency), and then removes the extension.
Changes:
- Added
microsoft_azure_extensions_customscript_boot_validation_testto install Custom Script extension (publisher/type/version optionally overridden via runbook variables) and assertprovisioning_state == "Succeeded". - Uses a dedicated extension instance name (
<publisher>_<extension_type>_boot_validation_test) and performs pre/post delete to avoid conflicts.
| extension = node.features[AzureExtension] | ||
| extension.delete(name=extension_name, ignore_not_found=True) | ||
|
|
||
| log.info(f"Installing extension '{extension_name}'...") | ||
| result = extension.create_or_update( | ||
| name=extension_name, | ||
| publisher=publisher, | ||
| type_=extension_type, | ||
| type_handler_version=version, | ||
| auto_upgrade_minor_version=True, | ||
| settings=settings, | ||
| ) | ||
|
|
||
| assert_that(result["provisioning_state"]).described_as( | ||
| "Expected the extension to succeed" | ||
| ).is_equal_to("Succeeded") | ||
|
|
||
| extension.delete(name=extension_name, ignore_not_found=True) |
|
@Jape96 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Wrap the install and provisioning-state assertion in try/finally so the extension is always deleted, even if create_or_update raises or the assertion fails, avoiding a leftover extension that could affect subsequent tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed in |
What
Adds a minimal, self-contained Custom Script VM extension boot validation test case to
CustomScriptTests(lisa/microsoft/testsuites/vm_extensions/runtime_extensions/custom_script.py).Details
commandToExecute(echo 'CSE test success') and nofileUris— so it requires no storage account and no public blob access (unlike the existing public/private cases that were downgraded to priority 5 due to blob public-access restrictions).provisioning_state == "Succeeded", then removes the extension.extension_publisher,extension_type,extension_version), defaulting to the Custom Script extension — same pattern asGenericVmExtension.verify_vm_extension_install_uninstall.<publisher>_<extension_type>_boot_validation_test.Testing
Ran end-to-end on Azure (Ubuntu 22.04, real VM deploy):
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com