From 87356f53941657ff8b4ab6a238584810bb1ab365 Mon Sep 17 00:00:00 2001 From: Gaurav Swami Date: Mon, 26 Apr 2021 20:10:10 +0530 Subject: [PATCH] Added fix for upstream pipeline failure https://gitlab.com/dogtagpki/pki/-/pipelines/291988444 Signed-off-by: Gaurav Swami --- .github/workflows/qe-tests.yml | 7 ++++--- tests/dogtag/pytest-ansible/.gitlab-ci.yml | 2 +- .../Test_Execution/tasks/configure_common.yml | 2 +- .../test_bug_1664435_pki_ca_scep_enrollment.py | 16 +++++++++++----- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/qe-tests.yml b/.github/workflows/qe-tests.yml index 12a40bf3168..53d7cfa6d01 100644 --- a/.github/workflows/qe-tests.yml +++ b/.github/workflows/qe-tests.yml @@ -85,10 +85,10 @@ jobs: - name: Set up inventory run: | - sed -e "s/TOPOLOGY/topology-02/g" ci/inventory > inventory + sed -e "s/TOPOLOGY/topology-00/g" ci/inventory > inventory ansible -i inventory -m setup master - - name: Set up topology-02 + - name: Set up topology-00 run: | mkdir -p /tmp/test_dir ansible-playbook \ @@ -107,7 +107,8 @@ jobs: --ansible-module-path tests/dogtag/pytest-ansible/common-modules \ --junit-xml pki_cert_junit.xml \ -qsvvv \ - tests/dogtag/pytest-ansible/pytest/sanity/test_role_users.py + tests/dogtag/pytest-ansible/pytest/ca/scep/test_bug_1664435_pki_ca_scep_enrollment.py + - name: Gather artifacts if: always() diff --git a/tests/dogtag/pytest-ansible/.gitlab-ci.yml b/tests/dogtag/pytest-ansible/.gitlab-ci.yml index 36a3e62dc79..089944ac238 100644 --- a/tests/dogtag/pytest-ansible/.gitlab-ci.yml +++ b/tests/dogtag/pytest-ansible/.gitlab-ci.yml @@ -250,7 +250,7 @@ topo-00-BZ-1664435-ca-scep-gs: stage: tier2-other script: - ansible-playbook -u fedora --become -i $HOSTFILE $PYTEST_DIR/installation/main.yml --extra-vars "topology=topology-00" -vv | sed 's/\\n/\n/g' - - py.test --html=$CI_PROJECT_DIR/${CI_JOB_NAME}_html_report.html --self-contained-html --ansible-user=fedora --ansible-become --ansible-inventory $HOSTFILE --ansible-host-pattern master --ansible-playbook-inventory $HOSTFILE --ansible-playbook-directory $PYTEST_DIR/pytest/ca/bugzilla/ $PYTEST_DIR/pytest-ansible/pytest/ca/scep/test_bug_1664435_pki_ca_scep_enrollment.py -qsvv --junitxml $CI_PROJECT_DIR/BZ_1664435_junit.xml + - py.test --html=$CI_PROJECT_DIR/${CI_JOB_NAME}_html_report.html --self-contained-html --ansible-user=fedora --ansible-become --ansible-inventory $HOSTFILE --ansible-host-pattern master $PYTEST_DIR/pytest/ca/scep/test_bug_1664435_pki_ca_scep_enrollment.py -q -s --junitxml $CI_PROJECT_DIR/BZ_1664435_junit.xml -qsvv #================================================================================================================================================================================================================= # diff --git a/tests/dogtag/pytest-ansible/installation/roles/Test_Execution/tasks/configure_common.yml b/tests/dogtag/pytest-ansible/installation/roles/Test_Execution/tasks/configure_common.yml index a357e4169c3..bb2181a6c88 100644 --- a/tests/dogtag/pytest-ansible/installation/roles/Test_Execution/tasks/configure_common.yml +++ b/tests/dogtag/pytest-ansible/installation/roles/Test_Execution/tasks/configure_common.yml @@ -82,7 +82,7 @@ when: ansible_distribution == "Fedora" tags: platform-ci -- name: Check for Removed dependency from mod_revocator and mod_nss.If failes refer BZ 1295276 +- name: Check for Removed dependency from mod_revocator and mod_nss.If failes refer BZ 1295276 command: rpm -q {{item}} with_items: - mod_revocator diff --git a/tests/dogtag/pytest-ansible/pytest/ca/scep/test_bug_1664435_pki_ca_scep_enrollment.py b/tests/dogtag/pytest-ansible/pytest/ca/scep/test_bug_1664435_pki_ca_scep_enrollment.py index b96d6c1b57c..3d3c1133744 100644 --- a/tests/dogtag/pytest-ansible/pytest/ca/scep/test_bug_1664435_pki_ca_scep_enrollment.py +++ b/tests/dogtag/pytest-ansible/pytest/ca/scep/test_bug_1664435_pki_ca_scep_enrollment.py @@ -44,7 +44,7 @@ sys.path.append('/tmp/test_dir') import constants log = logging.getLogger() -logging.basicConfig(stream=sys.stdout, level=logging.INFO) +logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) def test_topo00_setup_for_ldap_ca(ansible_module): @@ -146,10 +146,16 @@ def test_pki_ca_scep_enrollment_bz_1664435_1908541(ansible_module): # Run mkrequest cmd = ansible_module.command('mkrequest -ip {} {}'.format(ip_add, pwd)) + for result in cmd.values(): + assert result['rc'] == 0 + is_file = ansible_module.stat(path='/root/local.csr') + for r1 in is_file.values(): + assert r1['stat']['exists'] + time.sleep(5) # Run sscep getca - ansible_module.command('sscep getca -u http://{}:{}/ca/cgi-bin/pkiclient.exe -c ca.crt'. + ansible_module.command('sscep getca -u http://{}:{}/ca/cgi-bin/pkiclient.exe -c /root/ca.crt'. format(constants.MASTER_HOSTNAME, constants.CA_HTTP_PORT)) log.info('Successfully exported ca.crt with sscep') @@ -157,7 +163,7 @@ def test_pki_ca_scep_enrollment_bz_1664435_1908541(ansible_module): # Run sscep enroll with sha512 fingerprint cmd = ansible_module.command('sscep enroll -u http://{}:{}/ca/cgi-bin/pkiclient.exe ' - '-c ca.crt -k local.key -r local.csr -l cert.crt'. + '-c /root/ca.crt -k /root/local.key -r /root/local.csr -l /root/cert.crt'. format(constants.MASTER_HOSTNAME, constants.CA_HTTP_PORT)) for result in cmd.values(): if result['rc'] == 0: @@ -171,13 +177,13 @@ def test_pki_ca_scep_enrollment_bz_1664435_1908541(ansible_module): time.sleep(5) # Validate the enrolled cert for fingerprint match - cmd = ansible_module.shell('openssl x509 -in cert.crt -text -noout') + cmd = ansible_module.shell('openssl x509 -in /root/cert.crt -text -noout') for result in cmd.values(): assert 'Signature Algorithm: sha512WithRSAEncryption' in result['stdout'] log.info('Successfully matched the sha512 fingerprint') time.sleep(5) # Remove the generated cert and key - ansible_module.shell('rm -rf local.key local.csr cert.crt ca.crt') + ansible_module.shell('rm -rf /root/local.key /root/local.csr /root/cert.crt /root/ca.crt') log.info('Successfully removed the cert and key from server') \ No newline at end of file