-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff75677
commit 421cfa9
Showing
10 changed files
with
446 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
Feature: u.pro.services.enable | ||
|
||
Scenario Outline: u.pro.services.enable.v1 container services | ||
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed | ||
When I run `apt-get update` with sudo | ||
And I apt install `jq` | ||
And I attach `contract_token` with sudo and options `--no-auto-enable` | ||
|
||
# Basic enable | ||
And I run shell command `pro api u.pro.services.enable.v1 --args service=esm-infra | jq .data.attributes` with sudo | ||
Then I will see the following on stdout: | ||
""" | ||
{ | ||
"disabled": [], | ||
"enabled": [ | ||
"esm-infra" | ||
], | ||
"messages": [], | ||
"reboot_required": false | ||
} | ||
""" | ||
When I run shell command `pro api u.pro.status.enabled_services.v1 | jq .data.attributes.enabled_services ` with sudo | ||
Then stdout contains substring: | ||
""" | ||
esm-infra | ||
""" | ||
# Enable already enabled service succeeds | ||
When I run shell command `pro api u.pro.services.enable.v1 --args service=esm-infra | jq .data.attributes` with sudo | ||
Then I will see the following on stdout: | ||
""" | ||
{ | ||
"disabled": [], | ||
"enabled": [], | ||
"messages": [], | ||
"reboot_required": false | ||
} | ||
""" | ||
# Disallowing required services when required causes error | ||
When I verify that running `pro api u.pro.services.enable.v1 --data '{"service": "ros", "enable_required_services": false}'` `with sudo` exits `1` | ||
When I run shell command `pro api u.pro.services.enable.v1 --data \"{\\\"service\\\": \\\"ros\\\", \\\"enable_required_services\\\": false}\" | jq .errors[0]` with sudo | ||
Then I will see the following on stdout: | ||
""" | ||
{ | ||
"code": "enable-blocked-required-service", | ||
"meta": { | ||
"required": "esm-apps", | ||
"target": "ros" | ||
}, | ||
"title": "Could not enable ros because esm-apps is not enabled" | ||
} | ||
""" | ||
# Default allows enabling required services | ||
When I run shell command `pro api u.pro.services.enable.v1 --args service=ros | jq .data.attributes` with sudo | ||
Then I will see the following on stdout: | ||
""" | ||
{ | ||
"disabled": [], | ||
"enabled": [ | ||
"esm-apps", | ||
"ros" | ||
], | ||
"messages": [], | ||
"reboot_required": false | ||
} | ||
""" | ||
# Access only works and post enable messages work | ||
When I run shell command `pro api u.pro.services.enable.v1 --data \"{\\\"service\\\": \\\"cis\\\", \\\"access_only\\\": true}\" | jq .data.attributes` with sudo | ||
Then I will see the following on stdout: | ||
""" | ||
{ | ||
"disabled": [], | ||
"enabled": [ | ||
"cis" | ||
], | ||
"messages": [ | ||
"Visit https://ubuntu.com/security/cis to learn how to use CIS" | ||
], | ||
"reboot_required": false | ||
} | ||
""" | ||
When I run `apt-cache policy usg-common` as non-root | ||
Then stdout contains substring: | ||
""" | ||
Installed: (none) | ||
""" | ||
# Access only on service that doesn't support it fails | ||
When I verify that running `pro api u.pro.services.enable.v1 --data '{"service": "ros-updates", "access_only": true}'` `with sudo` exits `1` | ||
When I run shell command `pro api u.pro.services.enable.v1 --data \"{\\\"service\\\": \\\"ros-updates\\\", \\\"access_only\\\": true}\" | jq .errors[0]` with sudo | ||
Then I will see the following on stdout: | ||
""" | ||
{ | ||
"code": "entitlement-not-enabled", | ||
"meta": { | ||
"reason": { | ||
"code": "enable-access-only-not-supported", | ||
"title": "ROS ESM All Updates does not support being enabled with --access-only" | ||
} | ||
}, | ||
"title": "failed to enable ros-updates" | ||
} | ||
""" | ||
Examples: | ||
| release | machine_type | | ||
| xenial | lxd-container | | ||
| bionic | lxd-container | | ||
| focal | lxd-container | | ||
| jammy | lxd-container | | ||
Scenario Outline: u.pro.services.enable.v1 vm services | ||
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed | ||
When I run `apt-get update` with sudo | ||
And I apt install `jq` | ||
And I attach `contract_token` with sudo and options `--no-auto-enable` | ||
# Basic enable | ||
And I run shell command `pro api u.pro.services.enable.v1 --args service=livepatch | jq .data.attributes` with sudo | ||
Then I will see the following on stdout: | ||
""" | ||
{ | ||
"disabled": [], | ||
"enabled": [ | ||
"livepatch" | ||
], | ||
"messages": [], | ||
"reboot_required": false | ||
} | ||
""" | ||
# Enable without disable_incompatible fails | ||
When I verify that running `pro api u.pro.services.enable.v1 --data '{"service": "realtime-kernel", "disable_incompatible_services": false}'` `with sudo` exits `1` | ||
When I run shell command `pro api u.pro.services.enable.v1 --data \"{\\\"service\\\": \\\"realtime-kernel\\\", \\\"disable_incompatible_services\\\": false}\" | jq .errors[0]` with sudo | ||
Then I will see the following on stdout: | ||
""" | ||
{ | ||
"code": "enable-blocked-incompatible-service", | ||
"meta": { | ||
"incompatible": "livepatch", | ||
"target": "realtime-kernel" | ||
}, | ||
"title": "Could not enable realtime-kernel because livepatch is enabled" | ||
} | ||
""" | ||
# Enable with disable_incompatible works and variant works | ||
When I run shell command `pro api u.pro.services.enable.v1 --data \"{\\\"service\\\": \\\"realtime-kernel\\\", \\\"variant\\\": "intel-iotg"}\" | jq .data.attributes` with sudo | ||
Then I will see the following on stdout: | ||
""" | ||
{ | ||
"disabled": [ | ||
"livepatch" | ||
], | ||
"enabled": [ | ||
"realtime-kernel" | ||
], | ||
"messages": [], | ||
"reboot_required": false | ||
} | ||
""" | ||
When I run shell command `pro api u.pro.status.enabled_services.v1 | jq ".data.attributes.enabled_services | select(.name==\"realtime-kernel\")" ` with sudo | ||
Then stdout contains substring: | ||
""" | ||
{ | ||
"name": "realtime-kernel", | ||
"variant_enabled": true, | ||
"variant_name": "intel-iotg" | ||
} | ||
""" | ||
Examples: | ||
| release | machine_type | | ||
| jammy | lxd-vm | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Oops, something went wrong.