Skip to content

Check the installed verson when extension has patch version#4432

Open
lubaihua33 wants to merge 1 commit intomainfrom
baihua/fix0423
Open

Check the installed verson when extension has patch version#4432
lubaihua33 wants to merge 1 commit intomainfrom
baihua/fix0423

Conversation

@lubaihua33
Copy link
Copy Markdown
Collaborator

@lubaihua33 lubaihua33 commented Apr 23, 2026

Description

When installing a VM extension using the Python SDK or an ARM template, there is only a single parameter available for version control: typeHandlerVersion. This parameter only supports the Major.Minor format. However, for the pre-publish validation scenario, the version is in Major.Minor.Patch format.

Azure platform has the following behavior:
Customers are only able to specify the Major.Minor version during deployment of an extension. When AutoUpgradeMinorVersion is set "True", then the platform will deliver the latest Minor.Patch.Hotfix version of that Major version. If this value is set to "False" then the platform will deliver the latest Patch.Hotfix of the Major.Minor pair.

This PR adds a check for the installed version if the extension version passed in the case is Major.Minor.Patch format. From the response of GET VM extension, we can get the installed version from the instance_view.type_handler_version. Then check if the installed version same as the expected version. If yes, then the case is passed. If not, the case is failed.

Related Issue

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation update

Checklist

  • Description is filled in above
  • No credentials, secrets, or internal details are included
  • Peer review requested (if not, add required peer reviewers after raising PR)
  • Tests executed and results posted below

Test Validation

Test for the following runbooks:

  1. Case verify_vm_extension_install_uninstall should be PASSED.
    variable:
  • name: extension_publisher
    value: "Microsoft.Azure.Monitor"
    is_case_visible: true
  • name: extension_type
    value: "AzureMonitorLinuxAgent"
    is_case_visible: true
  • name: extension_version
    value: "1.7.1"
    is_case_visible: true
  1. Case verify_vm_extension_install_uninstall should be PASSED.
    variable:
  • name: extension_publisher
    value: "Microsoft.Azure.Monitor"
    is_case_visible: true
  • name: extension_type
    value: "AzureMonitorLinuxAgent"
    is_case_visible: true
  • name: extension_version
    value: "1.7"
    is_case_visible: true
  1. Case verify_vm_extension_install_uninstall should be FAILED.
    variable:
  • name: extension_publisher
    value: "Microsoft.Azure.Monitor"
    is_case_visible: true
  • name: extension_type
    value: "AzureMonitorLinuxAgent"
    is_case_visible: true
  • name: extension_version
    value: "1.7.0"
    is_case_visible: true

Key Test Cases:

verify_vm_extension_install_uninstall
Impacted LISA Features:

VM Extension
Tested Azure Marketplace Images:

-Canonical 0001-com-ubuntu-server-focal 20_04-lts-gen2 latest

Test Results

Image VM Size Result
PASSED / FAILED / SKIPPED

Copilot AI review requested due to automatic review settings April 23, 2026 07:06
@github-actions
Copy link
Copy Markdown

✅ AI Test Selection — PASSED

1 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Count
✅ Passed 0
❌ Failed 0
⏭️ Skipped 1
Total 1
Test case details
Test Case Status Time (s) Message
verify_vm_extension_install_uninstall (lisa_0_0) ⏭️ SKIPPED 8.377 skipped: Required runbook variable(s) are missing or empty: extension_publisher='', extension_type='', extension_version

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Azure VM extension version validation for pre-publish scenarios where an extension version may be provided as Major.Minor.Patch, while Azure deployment APIs only accept Major.Minor for typeHandlerVersion. It adds helper logic to normalize requested versions for installation and (optionally) validate the installed patch version via VM extension instance view.

Changes:

  • Added version parsing/normalization and installed-version lookup helpers to AzureExtension.
  • Updated verify_vm_extension_install_uninstall to install using normalized Major.Minor while validating installed Major.Minor.Patch when requested.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
lisa/sut_orchestrator/azure/features.py Add helpers to normalize typeHandlerVersion input and retrieve installed extension version from instance view.
lisa/microsoft/testsuites/vm_extensions/generic_vm_extension.py Use normalization for install and assert installed patch version when a patch version is requested.

Comment thread lisa/sut_orchestrator/azure/features.py
Comment thread lisa/sut_orchestrator/azure/features.py Outdated
Comment thread lisa/sut_orchestrator/azure/features.py Outdated
Comment thread lisa/microsoft/testsuites/vm_extensions/generic_vm_extension.py
Comment thread lisa/microsoft/testsuites/vm_extensions/generic_vm_extension.py Outdated
@github-actions
Copy link
Copy Markdown

✅ AI Test Selection — PASSED

1 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Count
✅ Passed 0
❌ Failed 0
⏭️ Skipped 1
Total 1
Test case details
Test Case Status Time (s) Message
verify_vm_extension_install_uninstall (lisa_0_0) ⏭️ SKIPPED 6.304 skipped: Required runbook variable(s) are missing or empty: extension_publisher='', extension_type='', extension_version

Copilot AI review requested due to automatic review settings April 30, 2026 05:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread lisa/microsoft/testsuites/vm_extensions/generic_vm_extension.py Outdated
Comment on lines +3388 to +3390
def get_installed_type_handler_version(self, name: str) -> str:
extension_obj = self.get(name=name)

Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_installed_type_handler_version() ultimately makes an Azure SDK call via self.get(). The Azure common module documents using global_credential_access_lock around SDK calls to avoid auth-file access conflicts in parallel runs. Consider wrapping the self.get(...) call (or the underlying SDK call) with global_credential_access_lock to align with that pattern and reduce intermittent failures under parallel execution.

Copilot uses AI. Check for mistakes.
Comment on lines +90 to +91
f"'{version}', actual '{installed_version}'. Please double confirm if "
f"the Azure platform supports {installed_version}"
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertion message reads a bit unclear/grammatically off ("double confirm") and doesn’t give a concrete next step beyond "platform supports". Consider rephrasing to something like: verify which patch version Azure delivers for the requested Major.Minor and check the extension’s published versions in this region; include the expected/actual values once.

Suggested change
f"'{version}', actual '{installed_version}'. Please double confirm if "
f"the Azure platform supports {installed_version}"
f"'{version}', actual '{installed_version}'. Verify which patch "
f"version Azure delivers for the requested major.minor version and "
f"check whether this extension version is published in the current "
f"region."

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

✅ AI Test Selection — PASSED

1 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Count
✅ Passed 0
❌ Failed 0
⏭️ Skipped 1
Total 1
Test case details
Test Case Status Time (s) Message
verify_vm_extension_install_uninstall (lisa_0_0) ⏭️ SKIPPED 6.214 skipped: Required runbook variable(s) are missing or empty: extension_publisher='', extension_type='', extension_version

@github-actions
Copy link
Copy Markdown

✅ AI Test Selection — PASSED

1 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Count
✅ Passed 0
❌ Failed 0
⏭️ Skipped 1
Total 1
Test case details
Test Case Status Time (s) Message
verify_vm_extension_install_uninstall (lisa_0_0) ⏭️ SKIPPED 7.734 skipped: Required runbook variable(s) are missing or empty: extension_publisher='', extension_type='', extension_version

Copilot AI review requested due to automatic review settings April 30, 2026 06:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@github-actions
Copy link
Copy Markdown

✅ AI Test Selection — PASSED

1 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Count
✅ Passed 0
❌ Failed 0
⏭️ Skipped 1
Total 1
Test case details
Test Case Status Time (s) Message
verify_vm_extension_install_uninstall (lisa_0_0) ⏭️ SKIPPED 8.195 skipped: Required runbook variable(s) are missing or empty: extension_publisher='', extension_type='', extension_version

@github-actions
Copy link
Copy Markdown

✅ AI Test Selection — PASSED

1 test case(s) selected (view run)

Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest

Count
✅ Passed 0
❌ Failed 0
⏭️ Skipped 1
Total 1
Test case details
Test Case Status Time (s) Message
verify_vm_extension_install_uninstall (lisa_0_0) ⏭️ SKIPPED 8.604 skipped: Required runbook variable(s) are missing or empty: extension_publisher='', extension_type='', extension_version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants