From b98fd9415065a72d7547ea9aa9b650bc7935bfe0 Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Fri, 3 Sep 2021 12:15:48 -0400 Subject: [PATCH 1/2] Install consumer RPM with yum and not RPM By using rpm to install the consumer RPM dependencies are not resolved and the tests can end up in a bad state of available dependencies such as subscription-manager which is removed when older RPMs are cleaned up. --- bats/fb-katello-client.bats | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bats/fb-katello-client.bats b/bats/fb-katello-client.bats index aacca3a3a..12252d9f7 100755 --- a/bats/fb-katello-client.bats +++ b/bats/fb-katello-client.bats @@ -16,10 +16,6 @@ load fixtures/content foreman-maintain packages unlock -y } -@test "install subscription manager" { - tPackageExists subscription-manager || tPackageInstall subscription-manager -} - @test "disable puppet agent to prevent checkin from registering host to another org" { systemctl is-active puppet || skip "Puppet is not active" systemctl stop puppet @@ -39,7 +35,7 @@ load fixtures/content run yum erase -y 'katello-ca-consumer-*' echo "rc=${status}" echo "${output}" - run rpm -Uvh http://localhost/pub/katello-ca-consumer-latest.noarch.rpm + tPackageInstall http://localhost/pub/katello-ca-consumer-latest.noarch.rpm echo "rc=${status}" echo "${output}" subscription-manager register --force --org="${ORGANIZATION_LABEL}" --username=admin --password=changeme --env=Library From 7cab41fbf164cfdbd712304053bc031dd7d634ad Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Sat, 4 Sep 2021 20:46:07 -0400 Subject: [PATCH 2/2] Add client tests through the proxy on install pipeline --- bats/fb-katello-proxy.bats | 4 +++ bats/foreman_helper.bash | 2 ++ pipelines/install/04-install_proxy.yaml | 32 +++++++++++++++++++ pipelines/install/05-tests.yaml | 10 ++++++ pipelines/install/06-proxy-tests.yaml | 22 +++++++++++++ pipelines/install/07-final-tests.yaml | 22 +++++++++++++ .../{06-smoker.yaml => 08-smoker.yaml} | 0 pipelines/install_pipeline.yml | 4 ++- 8 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 pipelines/install/06-proxy-tests.yaml create mode 100644 pipelines/install/07-final-tests.yaml rename pipelines/install/{06-smoker.yaml => 08-smoker.yaml} (100%) diff --git a/bats/fb-katello-proxy.bats b/bats/fb-katello-proxy.bats index a1da5fb34..e6eef748c 100755 --- a/bats/fb-katello-proxy.bats +++ b/bats/fb-katello-proxy.bats @@ -22,6 +22,10 @@ setup() { hammer capsule content add-lifecycle-environment --id=$PROXY_ID --environment="Library" --organization="${ORGANIZATION}" } +@test "enable test lifecycle environment for proxy" { + hammer capsule content add-lifecycle-environment --id=$PROXY_ID --environment="Test" --organization="${ORGANIZATION}" +} + @test "sync proxy" { hammer capsule content synchronize --id=$PROXY_ID } diff --git a/bats/foreman_helper.bash b/bats/foreman_helper.bash index 9973469af..ffb12c41d 100644 --- a/bats/foreman_helper.bash +++ b/bats/foreman_helper.bash @@ -24,6 +24,8 @@ tKatelloVersion() { tPackageVersion tfm-rubygem-katello elif tPackageExists rubygem-katello; then tPackageVersion rubygem-katello + elif tPackageExists foreman-proxy-content; then + tPackageVersion foreman-proxy-content fi ) | cut -d. -f1-2 } diff --git a/pipelines/install/04-install_proxy.yaml b/pipelines/install/04-install_proxy.yaml index 2c355cda1..d496fcc4f 100644 --- a/pipelines/install/04-install_proxy.yaml +++ b/pipelines/install/04-install_proxy.yaml @@ -27,3 +27,35 @@ scenario_version: "{{ pipeline_version }}" - foreman_proxy_content - foreman_installer + post_tasks: + - name: install hammer + package: + name: "{{ 'tfm-' if ansible_distribution_major_version == '7' else '' }}rubygem-hammer_cli_katello" + + - name: deploy hammer config + copy: + dest: /etc/hammer/cli.modules.d/foreman.yml + content: | + :foreman: + # Enable/disable foreman commands + :enable_module: true + + :username: 'admin' + :password: 'changeme' + + # Your foreman server address + :host: 'https://{{ server_fqdn }}' + + # Enable using sessions + # When sessions are enabled, hammer ignores credentials stored in the config file + # and asks for them interactively at the begining of each session. + :use_sessions: false + + # Check API documentation cache status on each request + :refresh_cache: false + + # API request timeout in seconds, set -1 for infinity + :request_timeout: 120 + + :ssl: + :ssl_ca_file: '/etc/pki/katello/certs/katello-server-ca.crt' diff --git a/pipelines/install/05-tests.yaml b/pipelines/install/05-tests.yaml index bf8c4de8b..bca7d9df7 100644 --- a/pipelines/install/05-tests.yaml +++ b/pipelines/install/05-tests.yaml @@ -16,3 +16,13 @@ - role: foreman_client_repositories when: pipeline_type != 'foreman' - role: foreman_testing + bats_tests: + - "fb-verify-packages.bats" + - "fb-test-foreman.bats" + - "fb-test-puppet.bats" + - "fb-test-katello.bats" + - "fb-katello-content.bats" + - "fb-katello-client.bats" + - "fb-katello-client-global-registration.bats" + - "fb-katello-proxy.bats" + bats_teardown: [] diff --git a/pipelines/install/06-proxy-tests.yaml b/pipelines/install/06-proxy-tests.yaml new file mode 100644 index 000000000..d6ab66996 --- /dev/null +++ b/pipelines/install/06-proxy-tests.yaml @@ -0,0 +1,22 @@ +--- +- name: run tests + hosts: + - "{{ forklift_proxy_name }}" + become: true + vars_files: + - ../vars/install_base.yml + - ../vars/repos_staging.yml + environment: + FOREMAN_EXPECTED_VERSION: "{{ foreman_expected_version | default('') }}" + roles: + - role: forklift_versions + scenario: "{{ pipeline_type }}" + scenario_os: "{{ pipeline_os }}" + scenario_version: "{{ pipeline_version }}" + - role: foreman_client_repositories + when: pipeline_type != 'foreman' + - role: foreman_testing + bats_tests: + - "fb-verify-packages.bats" + - "fb-katello-client.bats" + bats_teardown: [] diff --git a/pipelines/install/07-final-tests.yaml b/pipelines/install/07-final-tests.yaml new file mode 100644 index 000000000..c7be2449e --- /dev/null +++ b/pipelines/install/07-final-tests.yaml @@ -0,0 +1,22 @@ +--- +- name: run tests + hosts: + - "{{ forklift_server_name }}" + become: true + vars_files: + - ../vars/install_base.yml + - ../vars/repos_staging.yml + environment: + FOREMAN_EXPECTED_VERSION: "{{ foreman_expected_version | default('') }}" + roles: + - role: forklift_versions + scenario: "{{ pipeline_type }}" + scenario_os: "{{ pipeline_os }}" + scenario_version: "{{ pipeline_version }}" + - role: foreman_client_repositories + when: pipeline_type != 'foreman' + - role: foreman_testing + bats_tests: + - "fb-destroy-organization.bats" + bats_tests_additional: [] + bats_teardown: [] diff --git a/pipelines/install/06-smoker.yaml b/pipelines/install/08-smoker.yaml similarity index 100% rename from pipelines/install/06-smoker.yaml rename to pipelines/install/08-smoker.yaml diff --git a/pipelines/install_pipeline.yml b/pipelines/install_pipeline.yml index 584e80591..89c0d6cda 100644 --- a/pipelines/install_pipeline.yml +++ b/pipelines/install_pipeline.yml @@ -4,4 +4,6 @@ - import_playbook: install/03-install_server.yaml - import_playbook: install/04-install_proxy.yaml - import_playbook: install/05-tests.yaml -- import_playbook: install/06-smoker.yaml +- import_playbook: install/06-proxy-tests.yaml +- import_playbook: install/07-final-tests.yaml +- import_playbook: install/08-smoker.yaml