diff --git a/bats/fb-test-bootstrap.bats b/bats/fb-test-bootstrap.bats new file mode 100755 index 000000000..7a5cb6b2a --- /dev/null +++ b/bats/fb-test-bootstrap.bats @@ -0,0 +1,31 @@ +#!/usr/bin/env bats +# vim: ft=sh:sw=2:et + +set -o pipefail + +load os_helper +load foreman_helper +load fixtures/content + +setup() { + tSetOSVersion + HOSTNAME=$(hostname -f) +} + +@test "download bootstrap script from /pub and register to Satellite" { + source /root/.bash_profile + curl -o /root/bootstrap.py "http://${SERVERNAME}/pub/bootstrap.py" + python /root/bootstrap.py -s ${SERVERNAME} -o 'Default_Organization' -L 'Default Location' -a My_Activation_Key --hostgroup=My_Hostgroup --skip puppet --skip foreman --force + echo "rc=${status}" + echo "${output}" + yum -y install tracer-common + echo "rc=${status}" + echo "${output}" + } + +@test "Move client to get content from Capsule" { + source /root/.bash_profile + python /root/bootstrap.py -s ${CAPSULENAME} -o 'Default_Organization' -L 'Default Location' -a My_Activation_Key --hostgroup=My_Hostgroup --skip puppet --skip foreman --force + echo "rc=${status}" + echo "${output}" +} diff --git a/bats/fixtures/content.bash b/bats/fixtures/content.bash index 8c8555414..150e90f82 100644 --- a/bats/fixtures/content.bash +++ b/bats/fixtures/content.bash @@ -1,6 +1,6 @@ # vim: ft=sh:sw=2:et -ORGANIZATION="Test Organization" +ORGANIZATION="Default Organization" PRODUCT="Test Product" CONTAINER_REPOSITORY="fedorassh" FILE_REPOSITORY="file repo" @@ -8,14 +8,15 @@ PUPPET_REPOSITORY="Puppet Modules" YUM_REPOSITORY="Zoo" YUM_REPOSITORY_2="modules-rpms" YUM_REPOSITORY_3="rpm-deps" -LIFECYCLE_ENVIRONMENT="Test" -CONTENT_VIEW="Test CV" +LIFECYCLE_ENVIRONMENT="Library" +CONTENT_VIEW="Default Organization View" CONTENT_VIEW_2="Component 1" CONTENT_VIEW_3="Composite" -ACTIVATION_KEY="Test AK" +ACTIVATION_KEY="My_Activation_Key" FILTER1="errata excluder" FILTER2="rpm excluder" FILTER3="modulemd includer" +HOSTGROUP="My_Hostgroup" ORGANIZATION_LABEL="${ORGANIZATION/ /_}" PRODUCT_LABEL="${PRODUCT/ /_}" @@ -26,3 +27,4 @@ YUM_REPOSITORY_LABEL="${YUM_REPOSITORY/ /_}" LIFECYCLE_ENVIRONMENT_LABEL="${LIFECYCLE_ENVIRONMENT/ /_}" CONTENT_VIEW_LABEL="${CONTENT_VIEW/ /_}" ACTIVATION_KEY_LABEL="${ACTIVATION_KEY/ /_}" +HOSTGROUP_LABEL="${HOSTGROUP/ /_}" diff --git a/roles/bats/defaults/main.yaml b/roles/bats/defaults/main.yaml index e22849304..76376e489 100644 --- a/roles/bats/defaults/main.yaml +++ b/roles/bats/defaults/main.yaml @@ -1,22 +1,17 @@ --- 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_output_dir: "/root/bats_results" +bats_git_dir: "/tmp/bats" +bats_forklift_dir: "/tmp/forklift" +bats_forklift_repo: "https://github.com/swadeley/forklift.git" +bats_forklift_version: test-bootstrap-script +bats_output_dir: "/tmp/bats_results" bats_remote_dir: "/tmp/debug-{{ pipeline_type | default('foreman') }}-{{ pipeline_version | default('nightly') }}-{{ pipeline_os | default('el7') }}" bats_update_forklift: "yes" bats_run: true bats_setup: [] bats_tests: - - "fb-verify-packages.bats" - - "fb-test-foreman.bats" - - "fb-test-puppet.bats" - - "fb-test-katello.bats" - - "fb-content-katello.bats" + - "fb-test-bootstrap.bats" bats_tests_additional: [] bats_teardown: - - "fb-destroy-organization.bats" - "fb-finish.bats" diff --git a/roles/bats/tasks/main.yml b/roles/bats/tasks/main.yml index 592973d45..1d58bcb83 100644 --- a/roles/bats/tasks/main.yml +++ b/roles/bats/tasks/main.yml @@ -29,6 +29,11 @@ args: creates: "/usr/bin/bats" +- name: "Forklift directory" + file: + state: "directory" + path: "{{ bats_forklift_dir }}" + - name: "Clone forklift" git: repo: "{{ bats_forklift_repo }}" @@ -46,14 +51,19 @@ shell: "bats --tap {{ item }} > {{ bats_output_dir }}/{{ item }}.tap" args: chdir: "{{ bats_forklift_dir }}/bats" + vars: + bats_environment: + SERVERNAME: "{{ satdeploy_server_name }}.{{ ansible_domain }}" with_items: - "{{ bats_setup }}" - "{{ bats_tests }}" - - "{{ bats_tests_additional }}" - "{{ bats_teardown }}" register: "test_output" ignore_errors: true environment: "{{ bats_environment }}" + become: true + async: 220 + poll: 60 - name: "Read results" shell: "cat {{ bats_output_dir }}/{{ item }}.tap" @@ -61,7 +71,6 @@ with_items: - "{{ bats_setup }}" - "{{ bats_tests }}" - - "{{ bats_tests_additional }}" - "{{ bats_teardown }}" - name: "Output test results" diff --git a/roles/bats/vars/RedHat.yml b/roles/bats/vars/RedHat.yml index 65f1c3cfd..14f3bda48 100644 --- a/roles/bats/vars/RedHat.yml +++ b/roles/bats/vars/RedHat.yml @@ -4,5 +4,3 @@ bats_packages: - ruby - git - yum-utils - - podman - - sos diff --git a/roles/katello_client/tasks/main.yml b/roles/katello_client/tasks/main.yml index 53392f94d..0e1b09cab 100644 --- a/roles/katello_client/tasks/main.yml +++ b/roles/katello_client/tasks/main.yml @@ -1,6 +1,7 @@ --- -- name: 'Cleanup previous registrations' - include_tasks: cleanup.yml +- block: + - name: 'Cleanup previous registrations' + include_tasks: cleanup.yml when: katello_client_cleanup - name: 'Install bootstrap rpm' @@ -8,6 +9,10 @@ name: "http://{{ katello_client_server }}/pub/katello-ca-consumer-latest.noarch.rpm" disable_gpg_check: True state: "present" + become: true + register: install_result + +- debug: var=install_result - name: 'Register client with subscription-manager as user {{ katello_client_username }}' redhat_subscription: @@ -20,6 +25,7 @@ ignore_errors: "{{ katello_client_ignore_registration_errors }}" when: - katello_client_activationkey == "" + become: true - name: 'Register client with subscription-manager using AK {{ katello_client_activationkey }}' redhat_subscription: @@ -30,25 +36,44 @@ ignore_errors: "{{ katello_client_ignore_registration_errors }}" when: - katello_client_activationkey != "" + become: yes + register: output + async: 220 + poll: 30 - name: 'Enable extra repositories' command: subscription-manager repos --enable {{ item }} with_items: "{{ katello_client_extra_repos }}" + become: true + register: output + async: 220 + poll: 30 - name: 'Install katello-host-tools' yum: name: "katello-host-tools" state: "present" ignore_errors: yes + become: true + register: output + async: 220 + poll: 30 - name: 'Install katello-agent' yum: name: "katello-agent" state: "present" when: katello_client_install_agent + register: output + async: 220 + poll: 30 - name: 'Install katello-host-tools-tracer' yum: name: "katello-host-tools-tracer" state: "present" when: katello_client_install_tracer + become: yes + register: output + async: 220 + poll: 60