From ac0c7df590fc6441ca71dd6ac88a2e06708f3f04 Mon Sep 17 00:00:00 2001 From: Grant Orndorff Date: Tue, 13 Feb 2024 14:54:29 -0500 Subject: [PATCH] tests: various small fixes in prep for verifying 31 --- features/attached_commands.feature | 2 +- features/attached_enable.feature | 2 +- features/attached_status.feature | 3 +- features/daemon.feature | 4 +-- features/docker.feature | 9 ++++-- features/enable_fips_cloud.feature | 40 +++++++++--------------- features/retry_auto_attach.feature | 1 + features/steps/ubuntu_advantage_tools.py | 6 ++-- 8 files changed, 29 insertions(+), 38 deletions(-) diff --git a/features/attached_commands.feature b/features/attached_commands.feature index 988841a599..4e82e13214 100644 --- a/features/attached_commands.feature +++ b/features/attached_commands.feature @@ -830,7 +830,7 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription And I apt update And I run `pro enable --assume-yes` with sudo And I reboot the machine - Then I verify that `` is eanbled + Then I verify that `` is enabled When I run `uname -r` as non-root Then stdout matches regexp: """ diff --git a/features/attached_enable.feature b/features/attached_enable.feature index 4cb31b764e..e38fa0ecf4 100644 --- a/features/attached_enable.feature +++ b/features/attached_enable.feature @@ -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 `` `` machine with ubuntu-advantage-tools installed diff --git a/features/attached_status.feature b/features/attached_status.feature index c07d9f414e..dbb791009d 100644 --- a/features/attached_status.feature +++ b/features/attached_status.feature @@ -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 """ @@ -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 """ diff --git a/features/daemon.feature b/features/daemon.feature index 1c931b5fd6..92a8034812 100644 --- a/features/daemon.feature +++ b/features/daemon.feature @@ -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 @@ -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: @@ -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: diff --git a/features/docker.feature b/features/docker.feature index bb03ce3739..709bfc59dd 100644 --- a/features/docker.feature +++ b/features/docker.feature @@ -11,12 +11,13 @@ Feature: Build docker images with pro services FROM ubuntu: 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 \ @@ -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 \ @@ -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 \ diff --git a/features/enable_fips_cloud.feature b/features/enable_fips_cloud.feature index 050bd2b661..f3a0e1dd55 100644 --- a/features/enable_fips_cloud.feature +++ b/features/enable_fips_cloud.feature @@ -145,6 +145,7 @@ Feature: FIPS enablement in cloud based machines """ 1 """ + And I verify that `` is installed from apt source `` When I run `pro disable --assume-yes` with sudo Then stdout matches regexp: """ @@ -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 @@ -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 `` `` 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 | diff --git a/features/retry_auto_attach.feature b/features/retry_auto_attach.feature index c18527b946..04433bacc8 100644 --- a/features/retry_auto_attach.feature +++ b/features/retry_auto_attach.feature @@ -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: """ diff --git a/features/steps/ubuntu_advantage_tools.py b/features/steps/ubuntu_advantage_tools.py index f32830c137..553a822e76 100644 --- a/features/steps/ubuntu_advantage_tools.py +++ b/features/steps/ubuntu_advantage_tools.py @@ -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", ) @@ -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 )