From 75ed2fff27a23a7cc932d222b1f27d4c5dbd2b9c Mon Sep 17 00:00:00 2001 From: "Eric D. Helms" Date: Sat, 4 Sep 2021 20:46:07 -0400 Subject: [PATCH] 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 ++- roles/bats/defaults/main.yaml | 4 +-- 9 files changed, 97 insertions(+), 3 deletions(-) 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 diff --git a/roles/bats/defaults/main.yaml b/roles/bats/defaults/main.yaml index d41432d57..89af169bd 100644 --- a/roles/bats/defaults/main.yaml +++ b/roles/bats/defaults/main.yaml @@ -3,8 +3,8 @@ bats_fetch_results: true bats_environment: {} bats_git_dir: "/root/bats" bats_forklift_dir: "/root/forklift" -bats_forklift_repo: "https://github.com/theforeman/forklift.git" -bats_forklift_version: HEAD +bats_forklift_repo: "https://github.com/ehelms/forklift.git" +bats_forklift_version: fix-katello-client-sub-man bats_output_dir: "/root/bats_results" bats_remote_dir: "/tmp/debug-{{ pipeline_type | default('foreman') }}-{{ pipeline_version | default('nightly') }}-{{ pipeline_os | default('el7') }}" bats_update_forklift: "yes"