Skip to content

Commit

Permalink
tests: update landscape.feature for new landscape-config UX
Browse files Browse the repository at this point in the history
  • Loading branch information
orndorffgrant committed Nov 15, 2023
1 parent b4a0c39 commit c3232b3
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions features/landscape.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Feature: Enable landscape on Ubuntu
Then stdout contains substring:
"""
One moment, checking your subscription first
Updating Landscape package lists
Updating standard Ubuntu package lists
Installing landscape-client
Executing `landscape-config --computer-title $behave_var{machine-name system-under-test} --account-name pro-client-qa --registration-key <REDACTED> --silent`
"""
Then stdout contains substring
"""
System successfully registered.
Registration request sent successfully.
"""
When I run `pro status` as non-root
Then stdout matches regexp:
Expand Down Expand Up @@ -64,27 +64,35 @@ Feature: Enable landscape on Ubuntu
Run `sudo landscape-config` to set it up, or run `sudo pro disable landscape`
"""

# TODO: Known "Uninstalling" bug: #2839
When I run `sudo pro disable landscape` with sudo
Then I will see the following on stdout:
"""
Executing `landscape-config --disable`
Failed running command 'landscape-config --disable' [exit(1)]. Message: error: config file /etc/landscape/client.conf can't be read
Backing up /etc/landscape/client.conf as /etc/landscape/client.conf.pro-disable-backup
[Errno 2] No such file or directory: '/etc/landscape/client.conf' -> '/etc/landscape/client.conf.pro-disable-backup'
Uninstalling landscape-client
Uninstalling
"""
When I run `pro status` with sudo
Then stdout matches regexp:
"""
landscape +yes +disabled
landscape +yes +warning
"""
Then stdout contains substring:
"""
Landscape is installed but not configured.
Run `sudo landscape-config` to set it up, or run `sudo pro disable landscape`
"""
# TODO: Known status bug around not uninstalling landscape: #2840
When I run `apt-get remove -y landscape-client` with sudo

# Enable with assume-yes
When I run `pro enable landscape --assume-yes -- --computer-title $behave_var{machine-name system-under-test} --account-name pro-client-qa --registration-key $behave_var{config landscape_registration_key}` with sudo
Then I will see the following on stdout:
"""
One moment, checking your subscription first
Updating Landscape package lists
Updating standard Ubuntu package lists
Installing landscape-client
Executing `landscape-config --computer-title $behave_var{machine-name system-under-test} --account-name pro-client-qa --registration-key <REDACTED> --silent`
Landscape enabled
Expand All @@ -95,16 +103,17 @@ Feature: Enable landscape on Ubuntu
landscape +yes +enabled
"""
When I run `sudo pro disable landscape` with sudo
# TODO: Known status bug around not uninstalling landscape: #2840
When I run `apt-get remove -y landscape-client` with sudo

# Fail to enable with assume-yes
When I verify that running `pro enable landscape --assume-yes -- --computer-title $behave_var{machine-name system-under-test} --account-name pro-client-qa` `with sudo` exits `1`
Then I will see the following on stdout:
"""
One moment, checking your subscription first
Updating Landscape package lists
Updating standard Ubuntu package lists
Installing landscape-client
Executing `landscape-config --computer-title $behave_var{machine-name system-under-test} --account-name pro-client-qa --silent`
Created symlink /etc/systemd/system/multi-user.target.wants/landscape-client.service → /lib/systemd/system/landscape-client.service.
Invalid account name or registration key.
Could not enable Landscape.
"""
Expand All @@ -119,6 +128,8 @@ Feature: Enable landscape on Ubuntu
Run `sudo landscape-config` to register, or run `sudo pro disable landscape`
"""
When I run `sudo pro disable landscape` with sudo
# TODO: Known status bug around not uninstalling landscape: #2840
When I run `apt-get remove -y landscape-client` with sudo

# Enable with assume-yes and format json
When I run `pro enable landscape --assume-yes --format=json -- --computer-title $behave_var{machine-name system-under-test} --account-name pro-client-qa --registration-key $behave_var{config landscape_registration_key}` with sudo
Expand All @@ -132,12 +143,14 @@ Feature: Enable landscape on Ubuntu
landscape +yes +enabled
"""
When I run `sudo pro disable landscape` with sudo
# TODO: Known status bug around not uninstalling landscape: #2840
When I run `apt-get remove -y landscape-client` with sudo

# Fail to enable with assume-yes and format json
When I verify that running `pro enable landscape --assume-yes --format=json -- --computer-title $behave_var{machine-name system-under-test} --account-name pro-client-qa` `with sudo` exits `1`
Then I will see the following on stdout:
"""
{"_schema_version": "0.1", "errors": [{"additional_info": {"stderr": "Created symlink /etc/systemd/system/multi-user.target.wants/landscape-client.service \u2192 /lib/systemd/system/landscape-client.service.\nInvalid account name or registration key.", "stdout": "Please wait..."}, "message": "landscape-config command failed", "message_code": "landscape-config-failed", "service": "landscape", "type": "service"}], "failed_services": ["landscape"], "needs_reboot": false, "processed_services": [], "result": "failure", "warnings": []}
{"_schema_version": "0.1", "errors": [{"additional_info": {"stderr": "Invalid account name or registration key.", "stdout": ""}, "message": "landscape-config command failed", "message_code": "landscape-config-failed", "service": "landscape", "type": "service"}], "failed_services": ["landscape"], "needs_reboot": false, "processed_services": [], "result": "failure", "warnings": []}
"""
When I run `pro status` with sudo
Then stdout matches regexp:
Expand Down Expand Up @@ -181,54 +194,50 @@ Feature: Enable landscape on Ubuntu
# tags
# request registration
"""
y
n
$behave_var{machine-name system-under-test}
pro-client-qa
$behave_var{config landscape_registration_key}
$behave_var{config landscape_registration_key}
n
y
"""
Then stdout contains substring:
"""
One moment, checking your subscription first
Updating Landscape package lists
Updating standard Ubuntu package lists
Installing landscape-client
Executing `landscape-config`
"""
Then stdout contains substring:
"""
System successfully registered.
Registration request sent successfully.
"""
When I run `pro status` with sudo
Then stdout matches regexp:
"""
landscape +yes +enabled
"""
When I run `pro disable landscape` with sudo
# TODO: Known status bug around not uninstalling landscape: #2840
When I run `apt-get remove -y landscape-client` with sudo

When I verify that running `pro enable landscape` `with sudo` and the following stdin exits `1`
"""
y
n
$behave_var{machine-name system-under-test}
pro-client-qa
wrong
wrong
n
y
"""
Then stdout contains substring:
"""
One moment, checking your subscription first
Updating Landscape package lists
Updating standard Ubuntu package lists
Installing landscape-client
Executing `landscape-config`
"""
Expand Down

0 comments on commit c3232b3

Please sign in to comment.