test(vm_extensions): add AzureSecurityLinuxAgent boot validation test - #4637
test(vm_extensions): add AzureSecurityLinuxAgent boot validation test#4637vtahiliani wants to merge 4 commits into
Conversation
Adds a boot validation test case for the Azure Security Linux Agent VM extension (Microsoft.Azure.Security.Monitoring.AzureSecurityLinuxAgent), onboarding the publisher to Functional Validation. - New dedicated suite AzureSecurityLinuxAgentTests subclassing VmExtensionTestBase, reusing the shared install/assert/uninstall lifecycle helpers (no re-implemented lifecycle logic). - Single AzCertify-named boot validation case microsoft_azure_security_monitoring_azuresecuritylinuxagent_boot_validation_test that installs the extension, asserts provisioning succeeded and the VM stays reachable, then removes it. - Extension version is a runbook variable (azure_security_linux_agent_version), not hardcoded. - Starts at experimental maturity per the VM extension onboarding guide. - Adds runbook lisa/microsoft/runbook/azure_security_linux_agent.yml to run only this case (maturity criterion approves it past the stable gate). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new VM extension boot validation test suite to onboard Microsoft.Azure.Security.Monitoring.AzureSecurityLinuxAgent into the VM extension validation framework, plus a dedicated runbook to select only this case at experimental maturity.
Changes:
- Introduces
AzureSecurityLinuxAgentTests(subclassingVmExtensionTestBase) with a single boot-validation test case that installs the extension with minimal settings and validates provisioning/SSH reachability. - Adds a dedicated runbook to run only the new boot validation case, including an explicit
maturity: experimentalcriterion for selection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lisa/microsoft/testsuites/vm_extensions/runtime_extensions/azure_security_linux_agent.py | New dedicated VM extension boot validation suite/case for Azure Security Linux Agent. |
| lisa/microsoft/runbook/azure_security_linux_agent.yml | New runbook to run only the Azure Security Linux Agent boot validation case. |
| - name: azure_security_linux_agent_version | ||
| value: "2.0" |
| priority=1, | ||
| maturity="experimental", | ||
| ) |
- Runbook: default azure_security_linux_agent_version to empty so the required-version/skip-when-empty contract holds (no stale hardcoded 2.0). - Add explicit case-level requirement= to the boot validation TestCaseMetadata (Guideline 1000002). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b479e958-fe79-4af2-a99c-2fbdc15cc939
…handler The azure_security_linux_agent boot-validation case always skipped at runtime because the version variable was not case-visible: LISA only forwards variables marked 'is_case_visible: true' into a case's 'variables' dict, so the command-line/runbook version never reached the test and _get_version() skipped. Mark the runbook variable case-visible. Also, the handler is frequently auto-provisioned (e.g. Defender for Cloud) and Linux permits only one VM extension per handler, so a plain create_or_update failed with 'Multiple VMExtensions per handler not supported'. Detect an already-installed instance and validate it in place (provisioning Succeeded + VM reachable + log version); otherwise fall back to the normal install path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b479e958-fe79-4af2-a99c-2fbdc15cc939
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (3)
lisa/microsoft/runbook/azure_security_linux_agent.yml:23
- Major: This comment block implies the case always skips without a case-visible version variable, but if the handler is already installed the case will still run (it validates the existing instance). Please reword to clarify that a version is only needed when installing, and keep the 'is_case_visible' note focused on forwarding variables to the test.
# -v azure_security_linux_agent_version:<version>
# (or the generic -v extension_version:<version>). The case is skipped
# when neither is set. 'is_case_visible: true' is required so the value
# is passed into the test case's 'variables' dict at runtime (LISA only
# forwards case-visible variables); without it the case always skips.
lisa/microsoft/runbook/azure_security_linux_agent.yml:11
- Major: The runbook header says the version variable is always required and the test is skipped when empty, but the test case can validate an already-installed handler without needing any version variable. Please update this comment to reflect that the version is only required for the install path (handler not already present).
This issue also appears on line 19 of the same file.
# The version variable is REQUIRED; the test is skipped when it is empty.
lisa/microsoft/testsuites/vm_extensions/runtime_extensions/azure_security_linux_agent.py:99
- Minor: The PR description says the case "then removes the extension", but this code path returns early when an existing platform-managed instance is detected and does not uninstall it. Consider updating the PR description to reflect the "validate in place" behavior already documented in the test case docstring.
self._assert_vm_reachable(node)
return
…state
When validating an already-installed (auto-provisioned) AzureSecurityLinuxAgent
instance in place, the provisioning state can still be transient
('Creating'/'Updating') at the moment of discovery, causing a false failure
(observed on Azure Linux 3 and RHEL 9.5: 'Expected <Updating> to be equal to
<Succeeded>'). Poll the instance until it reaches a terminal state
('Succeeded'/'Failed') before asserting, with a bounded timeout.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b479e958-fe79-4af2-a99c-2fbdc15cc939
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (3)
lisa/microsoft/testsuites/vm_extensions/runtime_extensions/azure_security_linux_agent.py:159
- The wait loop uses
time.sleep()and, on timeout, logs "proceeding" but then returns a transient provisioning state that will immediately fail_assert_provisioned()with a less-informative assertion. Use LISA's bounded sleep helper and raise a clear timeout error when the state never becomes terminal.
if time.monotonic() >= deadline:
log.info(
f"Extension '{name}' still in transient state "
f"'{provisioning_state}' after {timeout}s; proceeding."
)
lisa/microsoft/testsuites/vm_extensions/runtime_extensions/azure_security_linux_agent.py:133
- The default timeout/interval values are test-behavior magic numbers. Add inline units/comments (or promote to named constants) so it's clear these are seconds and can be tuned intentionally.
timeout: int = 600,
interval: int = 20,
lisa/microsoft/runbook/azure_security_linux_agent.yml:23
- The runbook comments currently state the version variable is always required / the case always skips without
is_case_visible. That’s not accurate because the test has an "already installed" validation path that does not require a version. Please update the comments to match the test behavior so users don't assume a version is mandatory in all cases.
# REQUIRED: pass on the command line with
# -v azure_security_linux_agent_version:<version>
# (or the generic -v extension_version:<version>). The case is skipped
# when neither is set. 'is_case_visible: true' is required so the value
# is passed into the test case's 'variables' dict at runtime (LISA only
What
Adds a boot validation test for the Azure Security Linux Agent VM extension
(
Microsoft.Azure.Security.Monitoring.AzureSecurityLinuxAgent), onboarding thepublisher to Functional Validation.
Details
AzureSecurityLinuxAgentTestssubclassingVmExtensionTestBase(perdocs/vm_extension_validation_framework.rst),reusing the shared install / assert-provisioned / uninstall lifecycle helpers
— no re-implemented lifecycle logic.
microsoft_azure_security_monitoring_azuresecuritylinuxagent_boot_validation_test:installs the extension with minimal inline settings, asserts
provisioning_state == "Succeeded", verifies the installed handler version,confirms the VM stays reachable over SSH, then removes the extension.
(
azure_security_linux_agent_version), not hardcoded.experimentalmaturity per the onboarding guidance.lisa/microsoft/runbook/azure_security_linux_agent.ymlto runonly this case (includes a
maturity: experimentalcriterion so it isapproved past LISA's implicit stable gate).
Design note — prerequisites
The heavier AzSecPack/AutoConfig prerequisites in
azsecpack.py(managedidentity,
azure-mdsd, AMA-first,enableGenevaUpload/enableAutoConfig,AutoConfig-scope subscription) are AutoConfig-scenario requirements, not the
extension's minimal install contract. A boot validation only needs a supported
distro + waagent + connectivity, so this test does a plain CRP install and
leaves the deep autoconfig/service coverage to the existing
verify_azsecpack.Testing
black,isort,flake8clean.lisa list -t case -r lisa/microsoft/runbook/azure_security_linux_agent.ymldiscovers and selects the case (
selected count: 1).to provision on a supported Linux image — verify on first real run).
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com