Skip to content

Commit

Permalink
Added lxd vm test for attach validtoken
Browse files Browse the repository at this point in the history
Updated check livepatch disable test
  • Loading branch information
dheyay committed Feb 26, 2024
1 parent d6d2f4a commit 9c683e3
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 20 deletions.
42 changes: 42 additions & 0 deletions features/attach_validtoken.feature
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,48 @@ Feature: Command behaviour when attaching a machine to an Ubuntu Pro
| bionic | lxd-container | cis |
| focal | lxd-container | usg |

Scenario Outline: Auto enable by default and attached disable of livepatch in a lxd vm
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
When I attach `contract_token` with sudo
Then stdout matches regexp:
"""
Ubuntu Pro: ESM Infra enabled
"""
And stdout matches regexp:
"""
This machine is now attached to
"""
And stderr matches regexp:
"""
Enabling default service esm-infra
"""
Then I verify that `esm-infra` is enabled
And I verify that `esm-apps` is enabled
And I verify that `livepatch` status is `<livepatch_status>`

When I run `pro disable livepatch` with sudo
Then I verify that running `canonical-livepatch status` `with sudo` exits `1`
And stderr matches regexp:
"""
Machine is not enabled. Please run 'sudo canonical-livepatch enable' with the
token obtained from https://ubuntu.com/livepatch.
"""
And I verify that `livepatch` is disabled
When I verify that running `pro enable livepatch --access-only` `with sudo` exits `1`
Then I will see the following on stdout:
"""
One moment, checking your subscription first
Livepatch does not support being enabled with --access-only
"""

Examples: ubuntu release
| release | machine_type | livepatch_status |
| xenial | lxd-vm | warning |
| bionic | lxd-vm | enabled |
| focal | lxd-vm | enabled |
| jammy | lxd-vm | enabled |


Scenario Outline: Attach command in an generic cloud images
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
When I attach `contract_token` with sudo
Expand Down
38 changes: 18 additions & 20 deletions features/attached_enable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -517,33 +517,31 @@ Feature: Enable command behaviour when attached to an Ubuntu Pro subscription
| focal | lxd-container |
| focal | wsl |

Scenario Outline: Attached disable of livepatch in a lxd vm
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
Scenario Outline: Attach command in a ubuntu lxd vm
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
When I attach `contract_token` with sudo
Then I verify that `esm-apps` is enabled
And I verify that `esm-infra` is enabled
And I verify that `livepatch` status is `<livepatch_status>`
When I run `pro disable livepatch` with sudo
Then I verify that running `canonical-livepatch status` `with sudo` exits `1`
And stderr matches regexp:
Then stdout matches regexp:
"""
Machine is not enabled. Please run 'sudo canonical-livepatch enable' with the
token obtained from https://ubuntu.com/livepatch.
Ubuntu Pro: ESM Infra enabled
"""
And I verify that `esm-apps` is enabled
And I verify that `esm-infra` is enabled
And I verify that `livepatch` is disabled
When I verify that running `pro enable livepatch --access-only` `with sudo` exits `1`
Then I will see the following on stdout:
And stdout matches regexp:
"""
One moment, checking your subscription first
Livepatch does not support being enabled with --access-only
This machine is now attached to
"""
And stderr matches regexp:
"""
Enabling default service esm-infra
"""
Then I verify that `esm-infra` is enabled
And I verify that `esm-apps` is enabled
And I verify that `livepatch` is enabled

Examples: ubuntu release
| release | machine_type | livepatch_status |
| xenial | lxd-vm | warning |
| bionic | lxd-vm | enabled |
| release | machine_type |
| xenial | lxd-vm |
| bionic | lxd-vm |
| focal | lxd-vm |
| jammy | lxd-vm |

Scenario Outline: Attach works when snapd cannot be installed
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
Expand Down

0 comments on commit 9c683e3

Please sign in to comment.