blob: 1de372518a02be76f93f371175af261b3d82b8ae [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:
Andreas Jaeger99b085b2020-04-21 15:00:14 +020030 # TOX_CONSTRAINTS_FILE is new name, UPPER_CONSTRAINTS_FILE is old one, best to set both
31 tempest_tox_environment: "{{ tempest_tox_environment | combine({'UPPER_CONSTRAINTS_FILE': stable_constraints_file}) | combine({'TOX_CONSTRAINTS_FILE': stable_constraints_file}) }}"
Ghanshyam56149022020-02-05 15:53:26 -060032 when: target_branch in ["stable/ocata", "stable/pike", "stable/queens", "stable/rocky"]
33
34- name: Set OS_TEST_TIMEOUT if requested
35 set_fact:
36 tempest_tox_environment: "{{ tempest_tox_environment | combine({'OS_TEST_TIMEOUT': tempest_test_timeout}) }}"
37 when: tempest_test_timeout != ''
38
Michel Petersonef1a16d2018-02-23 20:20:22 +020039- when:
40 - tempest_test_blacklist is defined
41 block:
42 - name: Check for test blacklist file
43 stat:
44 path: "{{ tempest_test_blacklist }}"
45 register:
46 blacklist_stat
47
48 - name: Build blacklist option
49 set_fact:
50 blacklist_option: "--blacklist-file={{ tempest_test_blacklist|quote }}"
51 when: blacklist_stat.stat.exists
52
Andrea Frittoli (andreaf)7d5445d2017-10-03 18:43:05 +010053- name: Run Tempest
Sergey Vilgelm2979bff2018-11-06 10:34:03 -060054 command: tox -e {{tox_envlist}} {{tox_extra_args}} -- {{tempest_test_regex|quote}} {{blacklist_option|default('')}} \
Chandan Kumara9445042018-02-26 10:22:29 +000055 --concurrency={{tempest_concurrency|default(default_concurrency)}} \
56 --black-regex={{tempest_black_regex|quote}}
Andrea Frittoli (andreaf)7d5445d2017-10-03 18:43:05 +010057 args:
58 chdir: "{{devstack_base_dir}}/tempest"
Luigi Toscanob7746662020-04-17 13:31:00 +020059 register: tempest_run_result
Andrea Frittoli (andreaf)7d5445d2017-10-03 18:43:05 +010060 become: true
61 become_user: tempest
Ghanshyam56149022020-02-05 15:53:26 -060062 environment: "{{ tempest_tox_environment }}"