From b465c815a862a83953cf2f41b2939ef934406829 Mon Sep 17 00:00:00 2001 From: Grant Orndorff Date: Tue, 17 Sep 2024 12:54:42 -0400 Subject: [PATCH] tests: give jammy->noble upgrade its own test --- features/steps/machines.py | 10 ++++++ features/ubuntu_upgrade.feature | 63 +++++++++++++++++++++++++++++---- 2 files changed, 67 insertions(+), 6 deletions(-) diff --git a/features/steps/machines.py b/features/steps/machines.py index b2cdb45c13..7b7a1ceabb 100644 --- a/features/steps/machines.py +++ b/features/steps/machines.py @@ -286,3 +286,13 @@ def given_a_sut_machine_with_user_data(context, series, machine_type): @when("I reboot the machine") def when_i_reboot_the_machine(context, machine_name=SUT): context.machines[machine_name].instance.restart(wait=True) + + +@when("I update the series in the machine test metadata to `{series}`") +def when_i_update_series(context, series, machine_name=SUT): + context.machines[machine_name] = MachineTuple( + series=series, + machine_type=context.machines[machine_name].machine_type, + cloud=context.machines[machine_name].cloud, + instance=context.machines[machine_name].instance, + ) diff --git a/features/ubuntu_upgrade.feature b/features/ubuntu_upgrade.feature index ffc9342673..1c5433b285 100644 --- a/features/ubuntu_upgrade.feature +++ b/features/ubuntu_upgrade.feature @@ -45,12 +45,63 @@ Feature: Upgrade between releases when uaclient is attached """ Examples: ubuntu release - | release | machine_type | next_release | prompt | devel_release | service1 | service1_status | service2 | service2_status | before_cmd | - | xenial | lxd-container | bionic | lts | | esm-infra | enabled | esm-apps | enabled | true | - | bionic | lxd-container | focal | lts | | esm-infra | enabled | esm-apps | enabled | true | - | bionic | lxd-container | focal | lts | | usg | enabled | usg | enabled | pro enable cis | - | focal | lxd-container | jammy | lts | | esm-infra | enabled | esm-apps | enabled | true | - | jammy | lxd-container | noble | lts | --devel-release | esm-infra | enabled | esm-apps | enabled | true | + | release | machine_type | next_release | prompt | devel_release | service1 | service1_status | service2 | service2_status | before_cmd | + | xenial | lxd-container | bionic | lts | | esm-infra | enabled | esm-apps | enabled | true | + | bionic | lxd-container | focal | lts | | esm-infra | enabled | esm-apps | enabled | true | + | bionic | lxd-container | focal | lts | | usg | enabled | usg | enabled | pro enable cis | + | focal | lxd-container | jammy | lts | | esm-infra | enabled | esm-apps | enabled | true | + + @slow @upgrade + Scenario Outline: Attached upgrade jammy to noble + Given a `` `` machine with ubuntu-advantage-tools installed + When I attach `contract_token` with sudo + # Local PPAs are prepared and served only when testing with local debs + And I prepare the local PPAs to upgrade from `` to `` + And I run `DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade --assume-yes` with sudo + # Some packages upgrade may require a reboot + And I reboot the machine + And I create the file `/etc/update-manager/release-upgrades.d/ua-test.cfg` with the following + """ + [Sources] + AllowThirdParty=yes + """ + And I run `sed -i 's/Prompt=lts/Prompt=/' /etc/update-manager/release-upgrades` with sudo + And I run `do-release-upgrade --frontend DistUpgradeViewNonInteractive` `with sudo` and stdin `y\n` + When I run `systemctl mask apt-news.service` with sudo + When I run `systemctl mask esm-cache.service` with sudo + And I update the series in the machine test metadata to `` + And I install ubuntu-advantage-tools + When I run `systemctl unmask esm-cache.service` with sudo + When I run `systemctl unmask apt-news.service` with sudo + And I reboot the machine + And I run `lsb_release -cs` as non-root + Then I will see the following on stdout: + """ + + """ + And I verify that running `egrep "|disabled" /etc/apt/sources.list.d/*` `as non-root` exits `2` + And I will see the following on stdout: + """ + """ + When I run `pro refresh` with sudo + And I run `pro status --all` with sudo + Then stdout matches regexp: + """ + +yes + + """ + Then stdout matches regexp: + """ + +yes + + """ + When I run `pro detach --assume-yes` with sudo + Then stdout matches regexp: + """ + This machine is now detached. + """ + + Examples: ubuntu release + | release | machine_type | next_release | prompt | devel_release | service1 | service1_status | service2 | service2_status | + | jammy | lxd-container | noble | lts | --devel-release | esm-infra | enabled | esm-apps | enabled | @slow @upgrade Scenario Outline: Attached FIPS upgrade across LTS releases