core/dns: tolerate unattended-upgrade held-back packages on FDE/Ubunt… - #4626
core/dns: tolerate unattended-upgrade held-back packages on FDE/Ubunt…#4626SRIKKANTH wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the DNS core test suite’s Debian/Ubuntu upgrade step to avoid false negatives when unattended-upgrade -d -v exits non-zero due to held-back packages (common on Ubuntu Pro/FDE images), while still failing on genuine apt/dpkg errors.
Changes:
- Add regex markers to distinguish “upgrade completed” output from real apt/dpkg failure output.
- Change
_upgrade_system()to treat certain non-zerounattended-upgradeexits as non-fatal when output indicates upgrades were successfully applied.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
lisa/microsoft/testsuites/core/dns.py:183
- The raised LisaException message is too generic for troubleshooting. Including the exit code and a concrete next step (inspect stdout/stderr for apt/dpkg errors) would make failures actionable, especially now that non-zero exits can be non-fatal in some cases.
raise LisaException(
"fail to run apt update && unattended-upgrade -d -v"
)
| node.mark_dirty() | ||
| raise LisaException( | ||
| "fail to run apt update && unattended-upgrade -d -v" | ||
| combined_output = (result.stdout or "") + (result.stderr or "") |
AI Test Case SelectionSelected 87 test case(s): verify_default_targetpw,verify_grub,verify_network_manager_not_installed,verify_network_file_configuration,verify_ifcfg_eth0,verify_udev_rules_moved,verify_dhcp_file_configuration,verify_yum_conf,verify_os_update,verify_hv_kvp_daemon_installed,verify_repository_installed,verify_serial_console_is_enabled,verify_bash_history_is_empty,verify_boot_error_fail_warnings,verify_cloud_init_error_status,verify_client_active_interval,verify_no_pre_exist_users,verify_resource_disk_readme_file,verify_resource_disk_file_system,verify_waagent_version,verify_python_version,verify_openssl_version,verify_azure_64bit_os,verify_omi_version,verify_no_swap_on_osdisk,verify_essential_kernel_modules,verify_boot_with_debug_kernel,verify_l3_cache,verify_cpu_count,verify_vmbus_interrupts,verify_enable_kprobe,verify_dhcp_client_timeout,verify_floppy_module_is_blacklisted,verify_gdb,verify_lis_modules_version,verify_initrd_modules,verify_hyperv_modules,verify_reload_hyperv_modules,verify_kvp,verify_vmbus_devices_channels_bsd,verify_vmbus_devices_channels,verify_vmbus_heartbeat_properties,verify_hyperv_platform_id,verify_deployment_provision_synthetic_nic,verify_deployment_provision_standard_ssd_disk,verify_deployment_provision_ephemeral_managed_disk,verify_deployment_provision_premium_disk,verify_deployment_provision_premiumv2_disk,verify_deployment_provision_sriov,verify_reboot_in_platform,verify_deployment_provision_ultra_datadisk,verify_stop_start_in_platform,verify_deployment_provision_swiotlb_force,verify_sched_core_basic,verify_serial_console,verify_disks_device_timeout_setting,verify_resource_disk_mounted,verify_swap,verify_resource_disk_io,verify_scsi_disk_controller_type,verify_nvme_disk_controller_type,verify_os_partition_identifier,verify_hot_add_disk_serial,verify_hot_add_disk_serial_standard_ssd,verify_hot_add_disk_serial_premium_ssd,verify_hot_add_disk_parallel,verify_hot_add_disk_parallel_standard_ssd,verify_hot_add_disk_serial_random_lun_standard_ssd,verify_hot_add_disk_serial_random_lun_premium_ssd,verify_hot_add_disk_parallel_premium_ssd,verify_nfsv4_basic,verify_smb_linux,verify_cifs_basic,verify_timesync_ptp,verify_timesync_unbind_clocksource,verify_timesync_unbind_clockevent,verify_timesync_ntp,verify_timesync_chrony,verify_pmu_disabled_for_arm64,verify_timedrift_corrected,verify_vdso,verify_vm_hot_resize,verify_vm_hot_resize_decrease,verify_vm_resize_increase,verify_vm_resize_decrease,verify_zram_crypto_zstd,verify_zram_crypto_lz4 Marketplace image: Result: Failed |
…u Pro images verify_dns_name_resolution_after_upgrade failed with a false negative on Ubuntu 22.04 FDE Confidential VM images. `unattended-upgrade -d -v` returns a non-zero exit code whenever it holds back a package (conffile prompt, blacklisted or pinned package such as ubuntu-pro-client / ubuntu-advantage- tools), even though it prints "All upgrades installed" and every applicable upgrade — including the linux-*-azure-fde kernel stack — installed cleanly. _upgrade_system() treated any non-zero exit as fatal and raised LisaException, failing the case even though DNS resolution succeeded at every checkpoint and the VM rebooted into the new kernel. Fix: on a non-zero exit, treat the run as success when stdout contains "All upgrades installed" and no genuine apt/dpkg error marker is present (dpkg: error, E:, Errors were encountered, not fully installed, dpkg sub- process error). Only raise LisaException on a real error. A non-fatal held-back condition is now logged at INFO. Work item: 63384991
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
9592b46 to
ea223e7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (3)
lisa/microsoft/testsuites/core/dns.py:162
combined_outputconcatenates stdout and stderr without a separator, which can merge the last line of stdout with the first line of stderr and breakre.Mline-anchored matching. Add a newline delimiter between the streams.
combined_output = (result.stdout or "") + (result.stderr or "")
lisa/microsoft/testsuites/core/dns.py:54
- The real-error regex only matches apt errors that start with
E:(with a trailing space). apt often emitsE:with no space (e.g.E:Unable to locate package ...), which would bypasshas_real_errorand could incorrectly treat a genuine failure as a held-back success.
_upgrade_real_error_pattern = re.compile(
r"^(?:dpkg: error|E: |Errors were encountered)|"
r"not fully installed|"
r"Sub-process /usr/bin/dpkg returned an error",
re.M,
lisa/microsoft/testsuites/core/dns.py:183
- The raised LisaException message here is very generic and doesn’t include the exit code or guidance on what to check next. Since this branch is specifically for real apt/dpkg failures, include
result.exit_codeand a short investigation hint to make failures actionable.
raise LisaException(
"fail to run apt update && unattended-upgrade -d -v"
)
AI Test Case SelectionSelected 87 test case(s): verify_default_targetpw,verify_grub,verify_network_manager_not_installed,verify_network_file_configuration,verify_ifcfg_eth0,verify_udev_rules_moved,verify_dhcp_file_configuration,verify_yum_conf,verify_os_update,verify_hv_kvp_daemon_installed,verify_repository_installed,verify_serial_console_is_enabled,verify_bash_history_is_empty,verify_boot_error_fail_warnings,verify_cloud_init_error_status,verify_client_active_interval,verify_no_pre_exist_users,verify_resource_disk_readme_file,verify_resource_disk_file_system,verify_waagent_version,verify_python_version,verify_openssl_version,verify_azure_64bit_os,verify_omi_version,verify_no_swap_on_osdisk,verify_essential_kernel_modules,verify_boot_with_debug_kernel,verify_l3_cache,verify_cpu_count,verify_vmbus_interrupts,verify_enable_kprobe,verify_dhcp_client_timeout,verify_floppy_module_is_blacklisted,verify_gdb,verify_lis_modules_version,verify_initrd_modules,verify_hyperv_modules,verify_reload_hyperv_modules,verify_kvp,verify_vmbus_devices_channels_bsd,verify_vmbus_devices_channels,verify_vmbus_heartbeat_properties,verify_hyperv_platform_id,verify_deployment_provision_synthetic_nic,verify_deployment_provision_standard_ssd_disk,verify_deployment_provision_ephemeral_managed_disk,verify_deployment_provision_premium_disk,verify_deployment_provision_premiumv2_disk,verify_deployment_provision_sriov,verify_reboot_in_platform,verify_deployment_provision_ultra_datadisk,verify_stop_start_in_platform,verify_deployment_provision_swiotlb_force,verify_sched_core_basic,verify_serial_console,verify_disks_device_timeout_setting,verify_resource_disk_mounted,verify_swap,verify_resource_disk_io,verify_scsi_disk_controller_type,verify_nvme_disk_controller_type,verify_os_partition_identifier,verify_hot_add_disk_serial,verify_hot_add_disk_serial_standard_ssd,verify_hot_add_disk_serial_premium_ssd,verify_hot_add_disk_parallel,verify_hot_add_disk_parallel_standard_ssd,verify_hot_add_disk_serial_random_lun_standard_ssd,verify_hot_add_disk_serial_random_lun_premium_ssd,verify_hot_add_disk_parallel_premium_ssd,verify_nfsv4_basic,verify_smb_linux,verify_cifs_basic,verify_timesync_ptp,verify_timesync_unbind_clocksource,verify_timesync_unbind_clockevent,verify_timesync_ntp,verify_timesync_chrony,verify_pmu_disabled_for_arm64,verify_timedrift_corrected,verify_vdso,verify_vm_hot_resize,verify_vm_hot_resize_decrease,verify_vm_resize_increase,verify_vm_resize_decrease,verify_zram_crypto_zstd,verify_zram_crypto_lz4 Marketplace image: Result: Failed |
…u Pro images
verify_dns_name_resolution_after_upgrade failed with a false negative on Ubuntu 22.04 FDE Confidential VM images.
unattended-upgrade -d -vreturns a non-zero exit code whenever it holds back a package (conffile prompt, blacklisted or pinned package such as ubuntu-pro-client / ubuntu-advantage- tools), even though it prints "All upgrades installed" and every applicable upgrade — including the linux-*-azure-fde kernel stack — installed cleanly._upgrade_system() treated any non-zero exit as fatal and raised LisaException, failing the case even though DNS resolution succeeded at every checkpoint and the VM rebooted into the new kernel.
Fix: on a non-zero exit, treat the run as success when stdout contains "All upgrades installed" and no genuine apt/dpkg error marker is present (dpkg: error, E:, Errors were encountered, not fully installed, dpkg sub- process error). Only raise LisaException on a real error. A non-fatal held-back condition is now logged at INFO.
Description
Related Issue
Type of Change
Checklist
Test Validation
Key Test Cases:
Impacted LISA Features:
Tested Azure Marketplace Images:
Test Results