blob: 3e5772b1219528a9d27dd54bb9cfd8b8739ed164 [file] [log] [blame]
Andrea Frittoli (andreaf)7d5445d2017-10-03 18:43:05 +01001# NOTE(andreaf) The number of vcpus is not available on all systems.
2# See https://github.com/ansible/ansible/issues/30688
3# When not available, we fall back to ansible_processor_cores
4- name: Get hw.logicalcpu from sysctl
5 shell: sysctl hw.logicalcpu | cut -d' ' -f2
6 register: sysctl_hw_logicalcpu
7 when: ansible_processor_vcpus is not defined
8
9- name: Number of cores
10 set_fact:
11 num_cores: "{{ansible_processor_vcpus|default(sysctl_hw_logicalcpu.stdout)}}"
12
13- name: Set concurrency for cores == 3 or less
14 set_fact:
15 default_concurrency: "{{ num_cores }}"
16 when: num_cores|int <= 3
17
18- name: Limit max concurrency when more than 3 vcpus are available
19 set_fact:
20 default_concurrency: "{{ num_cores|int // 2 }}"
21 when: num_cores|int > 3
22
Ghanshyam56149022020-02-05 15:53:26 -060023- name: Override target branch
24 set_fact:
25 target_branch: "{{ zuul.override_checkout }}"
26 when: zuul.override_checkout is defined
27
28- name: Use stable branch upper-constraints till stable/rocky
29 set_fact:
30 tempest_tox_environment: "{{ tempest_tox_environment | combine({'UPPER_CONSTRAINTS_FILE': stable_constraints_file}) }}"
31 when: target_branch in ["stable/ocata", "stable/pike", "stable/queens", "stable/rocky"]
32
33- name: Set OS_TEST_TIMEOUT if requested
34 set_fact:
35 tempest_tox_environment: "{{ tempest_tox_environment | combine({'OS_TEST_TIMEOUT': tempest_test_timeout}) }}"
36 when: tempest_test_timeout != ''
37
Michel Petersonef1a16d2018-02-23 20:20:22 +020038- when:
39 - tempest_test_blacklist is defined
40 block:
41 - name: Check for test blacklist file
42 stat:
43 path: "{{ tempest_test_blacklist }}"
44 register:
45 blacklist_stat
46
47 - name: Build blacklist option
48 set_fact:
49 blacklist_option: "--blacklist-file={{ tempest_test_blacklist|quote }}"
50 when: blacklist_stat.stat.exists
51
Andrea Frittoli (andreaf)7d5445d2017-10-03 18:43:05 +010052- name: Run Tempest
Sergey Vilgelm2979bff2018-11-06 10:34:03 -060053 command: tox -e {{tox_envlist}} {{tox_extra_args}} -- {{tempest_test_regex|quote}} {{blacklist_option|default('')}} \
Chandan Kumara9445042018-02-26 10:22:29 +000054 --concurrency={{tempest_concurrency|default(default_concurrency)}} \
55 --black-regex={{tempest_black_regex|quote}}
Andrea Frittoli (andreaf)7d5445d2017-10-03 18:43:05 +010056 args:
57 chdir: "{{devstack_base_dir}}/tempest"
Luigi Toscanob7746662020-04-17 13:31:00 +020058 register: tempest_run_result
Andrea Frittoli (andreaf)7d5445d2017-10-03 18:43:05 +010059 become: true
60 become_user: tempest
Ghanshyam56149022020-02-05 15:53:26 -060061 environment: "{{ tempest_tox_environment }}"