fe2a59c4创建于 2022年8月22日历史提交
- name: Run tempest test
  hosts: controller
  become: true
  tasks:
    - name: Echo start Info
      debug:
        msg: "Start runing tempest test. Please wait more"

    - name: Run tempest test for cirros
      shell:
        cmd: tempest run --config-file etc/tempest-cirros.conf --exclude-list black_list_file 
        chdir: ~/mytest
      async: 14400
      poll: 10
      register: tempest_output
      ignore_errors: yes

    - name: Fetching tempest stdout
      async_status:
        jid: "{{ tempest_output.ansible_job_id }}"
      register: job_result
      until: job_result.finished
      delay: 5
      retries: 10
      ignore_errors: yes

    - name: Format the test result
      shell:
        cmd: |
          # ensure the tool installed.
          yum install python3-stestr python3-os-testr -y
          stestr last --subunit >> test_result
          subunit2html test_result
        chdir: ~/mytest

    - name: Fetch the test result
      fetch:
        src: /root/mytest/results.html
        dest: /tmp/results.html
        flat: true

    - name: Echo finish Info
      debug:
        msg: "Test is finished. Please see the result file 'results.html' in /tmp forlder."