Skip to content

Commit

Permalink
tests: various small fixes in prep for verifying 31
Browse files Browse the repository at this point in the history
  • Loading branch information
orndorffgrant committed Feb 13, 2024
1 parent ae56423 commit ac0c7df
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 38 deletions.
2 changes: 1 addition & 1 deletion features/attached_commands.feature
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
And I apt update
And I run `pro enable <fips-service> --assume-yes` with sudo
And I reboot the machine
Then I verify that `<fips-service>` is eanbled
Then I verify that `<fips-service>` is enabled
When I run `uname -r` as non-root
Then stdout matches regexp:
"""
Expand Down
2 changes: 1 addition & 1 deletion features/attached_enable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ Feature: Enable command behaviour when attached to an Ubuntu Pro subscription
"""
Examples: ubuntu release
| release | machine_type |
| xenial | aws.generic |
| xenial | lxd-container |

Scenario Outline: Attached enable esm-apps on a machine
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
Expand Down
3 changes: 2 additions & 1 deletion features/attached_status.feature
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ Feature: Attached status
esm-apps +yes +enabled +Expanded Security Maintenance for Applications
esm-infra +yes +enabled +Expanded Security Maintenance for Infrastructure
fips-preview +yes +disabled +Preview of FIPS crypto packages undergoing certification with NIST
fips-updates +yes +disabled +FIPS compliant crypto packages with stable security updates
livepatch +yes +enabled +Canonical Livepatch service
usg +yes +disabled +Security compliance and audit tools
"""
Expand All @@ -274,7 +275,7 @@ Feature: Attached status
esm-infra +yes +enabled +Expanded Security Maintenance for Infrastructure
fips +yes +n/a +NIST-certified FIPS crypto packages
fips-preview +yes +disabled +Preview of FIPS crypto packages undergoing certification with NIST
fips-updates +yes +n/a +FIPS compliant crypto packages with stable security updates
fips-updates +yes +disabled +FIPS compliant crypto packages with stable security updates
livepatch +yes +enabled +Canonical Livepatch service
usg +yes +disabled +Security compliance and audit tools
"""
Expand Down
4 changes: 1 addition & 3 deletions features/daemon.feature
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Feature: Pro Upgrade Daemon only runs in environments where necessary
# TODO find out what caused memory to go up, try to lower it again
Then on `xenial`, systemd status output says memory usage is less than `17` MB
Then on `bionic`, systemd status output says memory usage is less than `15` MB
Then on `focal`, systemd status output says memory usage is less than `13` MB
Then on `focal`, systemd status output says memory usage is less than `14` MB
Then on `jammy`, systemd status output says memory usage is less than `14` MB

When I run `journalctl -o cat -u ubuntu-advantage.service` with sudo
Expand Down Expand Up @@ -377,7 +377,6 @@ Feature: Pro Upgrade Daemon only runs in environments where necessary
"""
Active: inactive \(dead\).*
\s*Condition: start condition failed.*
.*ConditionPathExists=!/var/lib/ubuntu-advantage/private/machine-token.json was not met
"""
When I run `journalctl -o cat -u ubuntu-advantage.service` with sudo
Then stdout does not contain substring:
Expand All @@ -390,7 +389,6 @@ Feature: Pro Upgrade Daemon only runs in environments where necessary
"""
Active: inactive \(dead\)
\s*Condition: start condition failed.*
.*ConditionPathExists=!/var/lib/ubuntu-advantage/private/machine-token.json was not met
"""
When I run `journalctl -o cat -u ubuntu-advantage.service` with sudo
Then stdout does not contain substring:
Expand Down
9 changes: 6 additions & 3 deletions features/docker.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ Feature: Build docker images with pro services
FROM ubuntu:<container_release>
COPY ./ubuntu-advantage-tools.deb /ua.deb
COPY ./ubuntu-pro-client.deb /pro.deb
RUN --mount=type=secret,id=ua-attach-config \
apt-get update \
&& apt-get install --no-install-recommends -y ubuntu-advantage-tools ca-certificates \
&& ((dpkg -i /ua.deb || true)) \
&& ((apt install /ua.deb /pro.deb -y || true)) \
&& apt-get install -f \
Expand Down Expand Up @@ -86,12 +87,13 @@ Feature: Build docker images with pro services
ARG PRO_CLOUD_OVERRIDE=
COPY ./ubuntu-advantage-tools.deb /ua.deb
COPY ./ubuntu-pro-client.deb /pro.deb
RUN --mount=type=secret,id=ua-attach-config \
apt-get update \
&& apt-get install --no-install-recommends -y ubuntu-advantage-tools ca-certificates \
&& ((dpkg -i /ua.deb || true)) \
&& ((apt install /ua.deb /pro.deb -y || true)) \
&& apt-get install -f \
Expand Down Expand Up @@ -131,12 +133,13 @@ Feature: Build docker images with pro services
ARG PRO_CLOUD_OVERRIDE=
COPY ./ubuntu-advantage-tools.deb /ua.deb
COPY ./ubuntu-pro-client.deb /pro.deb
RUN --mount=type=secret,id=ua-attach-config \
apt-get update \
&& apt-get install --no-install-recommends -y ubuntu-advantage-tools ca-certificates \
&& ((dpkg -i /ua.deb || true)) \
&& ((apt install /ua.deb /pro.deb -y || true)) \
&& apt-get install -f \
Expand Down
40 changes: 14 additions & 26 deletions features/enable_fips_cloud.feature
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Feature: FIPS enablement in cloud based machines
"""
1
"""
And I verify that `<fips-package>` is installed from apt source `<fips-apt-source>`
When I run `pro disable <fips-service> --assume-yes` with sudo
Then stdout matches regexp:
"""
Expand All @@ -161,20 +162,26 @@ Feature: FIPS enablement in cloud based machines
Examples: ubuntu release
| release | machine_type | fips-name | fips-service | fips-package | fips-kernel | fips-apt-source |
| xenial | azure.generic | FIPS | fips | ubuntu-fips | fips | https://esm.ubuntu.com/fips/ubuntu xenial/main |
| xenial | azure.generic | FIPS Updates | fips-updates | ubuntu-fips | fips | https://esm.ubuntu.com/fips/ubuntu xenial/main |
| xenial | azure.generic | FIPS Updates | fips-updates | ubuntu-fips | fips | https://esm.ubuntu.com/fips-updates/ubuntu xenial-updates/main |
| xenial | aws.generic | FIPS | fips | ubuntu-fips | fips | https://esm.ubuntu.com/fips/ubuntu xenial/main |
| bionic | azure.generic | FIPS | fips | ubuntu-azure-fips | azure-fips | https://esm.ubuntu.com/fips/ubuntu bionic/main |
| bionic | azure.generic | FIPS Updates | fips-updates | ubuntu-azure-fips | azure-fips | https://esm.ubuntu.com/fips/ubuntu bionic/main |
| bionic | azure.generic | FIPS Updates | fips-updates | ubuntu-azure-fips | azure-fips | https://esm.ubuntu.com/fips-updates/ubuntu bionic-updates/main |
| bionic | aws.generic | FIPS | fips | ubuntu-aws-fips | aws-fips | https://esm.ubuntu.com/fips/ubuntu bionic/main |
| bionic | aws.generic | FIPS Updates | fips-updates | ubuntu-aws-fips | aws-fips | https://esm.ubuntu.com/fips/ubuntu bionic/main |
| bionic | aws.generic | FIPS Updates | fips-updates | ubuntu-aws-fips | aws-fips | https://esm.ubuntu.com/fips-updates/ubuntu bionic-updates/main |
| bionic | gcp.generic | FIPS | fips | ubuntu-gcp-fips | gcp-fips | https://esm.ubuntu.com/fips/ubuntu bionic/main |
| bionic | gcp.generic | FIPS Updates | fips-updates | ubuntu-gcp-fips | gcp-fips | https://esm.ubuntu.com/fips/ubuntu bionic/main |
| bionic | gcp.generic | FIPS Updates | fips-updates | ubuntu-gcp-fips | gcp-fips | https://esm.ubuntu.com/fips-updates/ubuntu bionic-updates/main |
| focal | azure.generic | FIPS | fips | ubuntu-azure-fips | azure-fips | https://esm.ubuntu.com/fips/ubuntu focal/main |
| focal | azure.generic | FIPS Updates | fips-updates | ubuntu-azure-fips | azure-fips | https://esm.ubuntu.com/fips/ubuntu focal/main |
| focal | azure.generic | FIPS Updates | fips-updates | ubuntu-azure-fips | azure-fips | https://esm.ubuntu.com/fips-updates/ubuntu focal-updates/main |
| focal | aws.generic | FIPS | fips | ubuntu-aws-fips | aws-fips | https://esm.ubuntu.com/fips/ubuntu focal/main |
| focal | aws.generic | FIPS Updates | fips-updates | ubuntu-aws-fips | aws-fips | https://esm.ubuntu.com/fips/ubuntu focal/main |
| focal | aws.generic | FIPS Updates | fips-updates | ubuntu-aws-fips | aws-fips | https://esm.ubuntu.com/fips-updates/ubuntu focal-updates/main |
| focal | gcp.generic | FIPS | fips | ubuntu-gcp-fips | gcp-fips | https://esm.ubuntu.com/fips/ubuntu focal/main |
| focal | gcp.generic | FIPS Updates | fips-updates | ubuntu-gcp-fips | gcp-fips | https://esm.ubuntu.com/fips/ubuntu focal/main |
| focal | gcp.generic | FIPS Updates | fips-updates | ubuntu-gcp-fips | gcp-fips | https://esm.ubuntu.com/fips-updates/ubuntu focal-updates/main |
| jammy | azure.generic | FIPS Preview | fips-preview | ubuntu-azure-fips | azure-fips | https://esm.ubuntu.com/fips-preview/ubuntu jammy/main |
| jammy | azure.generic | FIPS Updates | fips-updates | ubuntu-azure-fips | azure-fips | https://esm.ubuntu.com/fips-updates/ubuntu jammy-updates/main |
| jammy | aws.generic | FIPS Preview | fips-preview | ubuntu-aws-fips | aws-fips | https://esm.ubuntu.com/fips-preview/ubuntu jammy/main |
| jammy | aws.generic | FIPS Updates | fips-updates | ubuntu-aws-fips | aws-fips | https://esm.ubuntu.com/fips-updates/ubuntu jammy-updates/main |
| jammy | gcp.generic | FIPS Preview | fips-preview | ubuntu-gcp-fips | gcp-fips | https://esm.ubuntu.com/fips-preview/ubuntu jammy/main |
| jammy | gcp.generic | FIPS Updates | fips-updates | ubuntu-gcp-fips | gcp-fips | https://esm.ubuntu.com/fips-updates/ubuntu jammy-updates/main |

@slow
Scenario Outline: Attached enable of FIPS in an ubuntu image with cloud-init disabled
Expand Down Expand Up @@ -268,22 +275,3 @@ Feature: FIPS enablement in cloud based machines
| release | machine_type |
| bionic | aws.generic |
| focal | aws.generic |

Scenario Outline: Attached enable of FIPS in an ubuntu GCP vm
Given a `<release>` `<machine_type>` machine with ubuntu-advantage-tools installed
When I attach `contract_token` with sudo
And I verify that running `pro enable fips-updates --assume-yes` `with sudo` exits `1`
Then stdout matches regexp:
"""
FIPS Updates is not available for Ubuntu 22.04 LTS \(Jammy Jellyfish\)
"""
When I run `pro status --all` with sudo
Then stdout matches regexp:
"""
fips-updates +yes +n/a
"""

Examples: ubuntu release
| release | machine_type |
| jammy | aws.generic |
| jammy | azure.generic |
1 change: 1 addition & 0 deletions features/retry_auto_attach.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Feature: auto-attach retries periodically on failures
"""
creating flag file to trigger retries
"""
When I wait `20` seconds
Then I verify that running `systemctl status ubuntu-advantage.service` `with sudo` exits `0`
Then stdout matches regexp:
"""
Expand Down
6 changes: 3 additions & 3 deletions features/steps/ubuntu_advantage_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def when_i_have_the_debs_under_test(context, series, dest):
for package in ALL_BINARY_PACKAGE_NAMES:
when_i_run_shell_command(
context,
"cp {package}*.deb {package}.deb".format(package=package),
"cp {package}_*.deb {package}.deb".format(package=package),
"with sudo",
)

Expand Down Expand Up @@ -254,8 +254,8 @@ def when_i_install_pro(context, machine_name=SUT):
context, " ".join(to_install), machine_name=machine_name
)
else:
when_i_run_command(
context, "apt-get install ubuntu-advantage-pro", "with sudo"
when_i_apt_install(
context, "ubuntu-pro-auto-attach", machine_name=machine_name
)


Expand Down

0 comments on commit ac0c7df

Please sign in to comment.