Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: give jammy->noble upgrade its own test #3313

Merged
merged 3 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion features/apt_messages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ Feature: APT Messages
| release | machine_type | version |
| xenial | lxd-container | 16 |
| bionic | lxd-container | 18 |
| bionic | wsl | 18 |

@uses.config.contract_token
Scenario Outline: APT Hook advertises esm-apps on upgrade
Expand Down
10 changes: 10 additions & 0 deletions features/steps/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
2 changes: 1 addition & 1 deletion features/timer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ Feature: Timer for regular background jobs while attached
| release | machine_type |
| xenial | lxd-container |
| bionic | lxd-container |
| bionic | wsl |
| focal | lxd-container |
| focal | wsl |
| jammy | lxd-container |
| noble | lxd-container |
| oracular | lxd-container |
Expand Down
73 changes: 67 additions & 6 deletions features/ubuntu_upgrade.feature
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,73 @@ 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 |

# This test is unideal.
# do-release-upgrade started disabling proposed on upgrade, which prevents us from testing the upgrade from
# jammy-proposed to noble-proposed of pro-client. Ideally we'd have a way to leave -proposed enabled during the upgrade.
# Since there is no feature of do-release-upgrade to leave -proposed enabled, this test does the release upgrade,
# then re-enables proposed and then installs pro-client from -proposed.
# This is unideal, because the jammy-proposed pro-client will still be installed until the extra steps to re-enable
# -proposed and upgrade from there. The jammy-proposed release-upgrades.d script will run, and the jammy-proposed
# apparmor profiles will remain installed. The apparmor profiles are particularly problematic, because the noble
# profiles require extra rules. That is why this test needs to mask the apparmored systemd units during the upgrade of
# pro-client after the release upgrade.
@slow @upgrade
orndorffgrant marked this conversation as resolved.
Show resolved Hide resolved
Scenario Outline: Attached upgrade jammy to noble
Given a `<release>` `<machine_type>` 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 `<release>` to `<next_release>`
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=<prompt>/' /etc/update-manager/release-upgrades` with sudo
And I run `do-release-upgrade <devel_release> --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 `<next_release>`
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:
"""
<next_release>
"""
And I verify that running `egrep "<release>|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:
"""
<service1> +yes +<service1_status>
"""
Then stdout matches regexp:
"""
<service2> +yes +<service2_status>
"""
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
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ deps =
behave
jsonschema
jq
pycloudlib==1!6.5.0
pycloudlib==1!9.2.0
PyHamcrest
requests
toml==0.10
Expand Down
Loading