Switch to 2-node configuration for IR plugin testing
Change-Id: Ifeed49ee6a5f57fc2ebf69adbae16894ad3c69a2
This commit is contained in:
parent
c9716ccac2
commit
ac7a4a6d61
@ -1,39 +1,8 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
vars:
|
||||
zuul_output_dir: '{{ ansible_user_dir }}/zuul-output'
|
||||
test_collect_dir: '{{ zuul_output_dir }}/logs'
|
||||
|
||||
- hosts: primary
|
||||
roles:
|
||||
- role: tobiko-ensure-python3
|
||||
|
||||
- name: "run Tox InfraRed plugin"
|
||||
role: tox
|
||||
vars:
|
||||
tox_envlist: infrared
|
||||
tox_extra_args: '-- --collect-dir {{ test_collect_dir | quote }}'
|
||||
|
||||
tasks:
|
||||
- name: "list collected files"
|
||||
command: >
|
||||
ls '{{ test_collect_dir }}'
|
||||
register: list_test_result_files
|
||||
|
||||
- name: "set collected files fact"
|
||||
set_fact:
|
||||
collected_files: '{{ list_test_result_files.stdout_lines }}'
|
||||
|
||||
- name: "show collected files"
|
||||
debug: var=collected_files
|
||||
|
||||
- name: "check collected files"
|
||||
assert:
|
||||
that:
|
||||
- item in collected_files
|
||||
loop:
|
||||
- tobiko.log
|
||||
- tobiko.conf
|
||||
- test_results.html
|
||||
- test_results.subunit
|
||||
- test_results.xml
|
||||
- role: tobiko-inventory
|
||||
- role: tox
|
||||
- role: tobiko-check-collected-files
|
||||
|
2
roles/tests/Vagrantfile
vendored
2
roles/tests/Vagrantfile
vendored
@ -8,7 +8,7 @@ VAGRANTFILE_API_VERSION = "2"
|
||||
CPUS = 4
|
||||
|
||||
# Customize the amount of memory on the VM
|
||||
MEMORY = ENV.fetch("VM_SIZE", "512").to_i
|
||||
MEMORY = ENV.fetch("VM_SIZE", "1024").to_i
|
||||
|
||||
# Every Vagrant development environment requires a box. You can search for
|
||||
# boxes at https://vagrantcloud.com/search.
|
||||
|
@ -1,25 +1,5 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: "show platform id variables"
|
||||
debug:
|
||||
msg:
|
||||
ansible_architecture: '{{ ansible_architecture }}'
|
||||
ansible_distribution: '{{ ansible_distribution }}'
|
||||
ansible_distribution_major_version: '{{ ansible_distribution_major_version }}'
|
||||
ansible_os_family: '{{ ansible_os_family }}'
|
||||
|
||||
- name: "include platform variables"
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "provision-{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
||||
- "provision-{{ ansible_distribution }}.{{ ansible_architecture }}.yaml"
|
||||
- "provision-{{ ansible_distribution }}.yaml"
|
||||
- "provision-{{ ansible_os_family }}.yaml"
|
||||
register: include_platform_vars
|
||||
|
||||
|
||||
- hosts: primary
|
||||
tasks:
|
||||
- name: "copy /etc/resolv.conf"
|
||||
@ -66,11 +46,6 @@
|
||||
- ''
|
||||
- '.pub'
|
||||
|
||||
- name: "make Ansible inventory file with vagrant nodes"
|
||||
template:
|
||||
src: 'ansible_hosts.j2'
|
||||
dest: '/vagrant/ansible_hosts'
|
||||
|
||||
|
||||
- hosts: all
|
||||
tasks:
|
||||
@ -92,12 +67,12 @@
|
||||
|
||||
- hosts: primary
|
||||
tasks:
|
||||
|
||||
- name: "check ICMP connectivity"
|
||||
shell: |
|
||||
set -xe
|
||||
ping -c 1 '{{ item.1.ip }}'
|
||||
ping -c 1 '{{ item.1.hostname }}'
|
||||
changed_when: false
|
||||
register: check_icmp_connectivity
|
||||
loop: '{{ vagrant_nodes | dictsort }}'
|
||||
|
||||
@ -107,5 +82,29 @@
|
||||
ssh '{{ item.1.ip }}' hostname
|
||||
ssh '{{ item.1.hostname }}' hostname
|
||||
ssh '{{ item.0 }}' hostname
|
||||
changed_when: false
|
||||
register: check_ssh_connectivity
|
||||
loop: '{{ vagrant_nodes | dictsort }}'
|
||||
|
||||
- name: "set test_inventory_hostvars_yaml fact"
|
||||
set_fact:
|
||||
test_inventory_hostvars_yaml: |
|
||||
---
|
||||
{% for name, node in (vagrant_nodes | dictsort) %}
|
||||
{{ name }}:
|
||||
ansible_host: {{ node.hostname }}
|
||||
{% endfor %}
|
||||
|
||||
- name: "set test_inventory_hostvars fact"
|
||||
set_fact:
|
||||
test_inventory_hostvars:
|
||||
'{{ test_inventory_hostvars_yaml | from_yaml }}'
|
||||
|
||||
- debug: var=test_inventory_hostvars
|
||||
|
||||
|
||||
- hosts: primary
|
||||
roles:
|
||||
- role: tobiko-inventory
|
||||
vars:
|
||||
test_inventory_file: /vagrant/ansible_hosts
|
||||
|
@ -1,9 +0,0 @@
|
||||
|
||||
[vagrant]
|
||||
{% for node in (vagrant_nodes | dictsort) %}
|
||||
{{ node.0 }}
|
||||
{% endfor %}
|
||||
|
||||
[vagrant:vars]
|
||||
ansible_python_interpreter = {{ ansible_python_interpreter }}
|
||||
|
@ -11,4 +11,3 @@
|
||||
{% for node in (vagrant_nodes | dictsort) %}
|
||||
{{ node.1.ip }} {{ node.1.hostname }}
|
||||
{% endfor %}
|
||||
|
||||
|
@ -1,18 +1,16 @@
|
||||
---
|
||||
|
||||
- hosts: primary
|
||||
|
||||
vars:
|
||||
test_src_dir: /vagrant
|
||||
test_collect_dir: '{{ test_src_dir }}/test_results'
|
||||
|
||||
roles:
|
||||
- tobiko-ensure-tox
|
||||
- tobiko-ensure-git
|
||||
- tobiko-ensure-rsync
|
||||
|
||||
tasks:
|
||||
- name: "remove collected files"
|
||||
- name: "remove '{{ test_collect_dir }}' dir"
|
||||
file:
|
||||
path: '{{ test_collect_dir }}'
|
||||
state: absent
|
||||
@ -35,25 +33,10 @@
|
||||
when: run_tox is failed
|
||||
failed_when: yes
|
||||
|
||||
- name: "list collected files"
|
||||
command: >
|
||||
ls '{{ test_collect_dir }}'
|
||||
register: list_test_result_files
|
||||
|
||||
- name: "set collected files fact"
|
||||
set_fact:
|
||||
collected_files: '{{ list_test_result_files.stdout_lines }}'
|
||||
|
||||
- name: "show collected files"
|
||||
debug: var=collected_files
|
||||
|
||||
- name: "check collected files"
|
||||
assert:
|
||||
that:
|
||||
- item in collected_files
|
||||
loop:
|
||||
- tobiko.log
|
||||
- tobiko.conf
|
||||
- test_results.html
|
||||
- test_results.subunit
|
||||
- test_results.xml
|
||||
- hosts: primary
|
||||
vars:
|
||||
test_src_dir: /vagrant
|
||||
test_collect_dir: '{{ test_src_dir }}/test_results'
|
||||
roles:
|
||||
- tobiko-check-collected-files
|
||||
|
@ -1,3 +0,0 @@
|
||||
---
|
||||
|
||||
ansible_python_interpreter: /usr/libexec/platform-python
|
@ -1,3 +0,0 @@
|
||||
---
|
||||
|
||||
ansible_python_interpreter: /usr/bin/python3
|
4
roles/tobiko-check-collected-files/meta/main.yaml
Normal file
4
roles/tobiko-check-collected-files/meta/main.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
dependencies:
|
||||
- role: tobiko-common
|
40
roles/tobiko-check-collected-files/tasks/main.yaml
Normal file
40
roles/tobiko-check-collected-files/tasks/main.yaml
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
|
||||
- name: "find for collected files in '{{ test_collect_dir }}'"
|
||||
find:
|
||||
paths:
|
||||
- "{{ test_collect_dir }}"
|
||||
patterns:
|
||||
- "tobiko.conf"
|
||||
- "tobiko.log"
|
||||
- "{{ test_report_name }}*.log"
|
||||
- "{{ test_report_name }}*.subunit"
|
||||
- "{{ test_report_name }}*.html"
|
||||
- "{{ test_report_name }}*.xml"
|
||||
register: find_collected_files
|
||||
|
||||
|
||||
- name: "set collected_files fact"
|
||||
set_fact:
|
||||
collected_files: >
|
||||
{{ find_collected_files.files |
|
||||
map(attribute='path') |
|
||||
map('basename') |
|
||||
list }}
|
||||
|
||||
|
||||
- block:
|
||||
- name: "check collected files"
|
||||
assert:
|
||||
that:
|
||||
- item in collected_files
|
||||
loop:
|
||||
- tobiko.log
|
||||
- tobiko.conf
|
||||
- '{{ test_report_name }}.html'
|
||||
- '{{ test_report_name }}.subunit'
|
||||
- '{{ test_report_name }}.xml'
|
||||
|
||||
rescue:
|
||||
- debug: var=collected_files
|
||||
failed_when: yes
|
5
roles/tobiko-inventory/defaults/main.yaml
Normal file
5
roles/tobiko-inventory/defaults/main.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
test_inventory_user: '{{ ansible_user }}'
|
||||
test_inventory_hostvars: {}
|
||||
test_inventory_file: '{{ test_src_dir | realpath }}/ansible_hosts'
|
4
roles/tobiko-inventory/meta/main.yaml
Normal file
4
roles/tobiko-inventory/meta/main.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
|
||||
dependencies:
|
||||
- role: tobiko-common
|
65
roles/tobiko-inventory/tasks/main.yaml
Normal file
65
roles/tobiko-inventory/tasks/main.yaml
Normal file
@ -0,0 +1,65 @@
|
||||
---
|
||||
|
||||
- name: "read platform vars from file"
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- "test-inventory-{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yaml"
|
||||
- "test-inventory-{{ ansible_distribution }}.{{ ansible_architecture }}.yaml"
|
||||
- "test-inventory-{{ ansible_distribution }}.yaml"
|
||||
- "test-inventory-{{ ansible_os_family }}.yaml"
|
||||
register: include_platform_vars
|
||||
|
||||
|
||||
- debug: var=test_inventory_python_interpreter
|
||||
|
||||
|
||||
- when: test_inventory_user is not defined
|
||||
block:
|
||||
- name: "get remote username"
|
||||
command: whoami
|
||||
changed_when: false
|
||||
become: false
|
||||
register: get_inventory_user
|
||||
|
||||
- name: "set test_inventory_user fact"
|
||||
set_fact:
|
||||
test_inventory_user: "{{ get_inventory_user.stdout_lines | first }}"
|
||||
|
||||
|
||||
- debug: var=test_inventory_user
|
||||
|
||||
|
||||
- name: "get default test_inventory_hostvars entries from hostvars"
|
||||
set_fact:
|
||||
test_inventory_hostvars: >
|
||||
{{ {hostname: {varname: value} } |
|
||||
combine(test_inventory_hostvars) }}
|
||||
vars:
|
||||
hostname: '{{ item.0 }}'
|
||||
varname: '{{ item.1 }}'
|
||||
value: '{{ hostvars[hostname][varname] }}'
|
||||
loop: "{{ hostvars.keys() | product(['ansible_host']) | list }}"
|
||||
loop_control:
|
||||
label: '{{ hostname }}.{{ varname }} = {{ value }}'
|
||||
when:
|
||||
- hostvars[hostname][varname] is defined
|
||||
- test_inventory_hostvars[hostname][varname] is not defined
|
||||
|
||||
|
||||
- debug: var=test_inventory_hostvars
|
||||
|
||||
|
||||
- name: "writes inventory file to: '{{ test_inventory_file }}'"
|
||||
template:
|
||||
src: 'test_inventory.j2'
|
||||
dest: '{{ test_inventory_file }}'
|
||||
|
||||
|
||||
- name: "read inventory file from: '{{ test_inventory_file }}'"
|
||||
command: "cat '{{ test_inventory_file }}'"
|
||||
changed_when: false
|
||||
register: read_test_inventory_file
|
||||
|
||||
|
||||
- name: "show inventory file: '{{ test_inventory_file }}'"
|
||||
debug: var=read_test_inventory_file.stdout_lines
|
8
roles/tobiko-inventory/templates/test_inventory.j2
Normal file
8
roles/tobiko-inventory/templates/test_inventory.j2
Normal file
@ -0,0 +1,8 @@
|
||||
[all]
|
||||
{% for name, vars in (test_inventory_hostvars | dictsort) %}
|
||||
{{ name }} ansible_host={{ vars.ansible_host }}
|
||||
{% endfor %}
|
||||
|
||||
[all:vars]
|
||||
ansible_python_interpreter = {{ test_inventory_python_interpreter }}
|
||||
ansible_user = {{ test_inventory_user }}
|
3
roles/tobiko-inventory/vars/test-inventory-CentOS-7.yaml
Normal file
3
roles/tobiko-inventory/vars/test-inventory-CentOS-7.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
|
||||
test_inventory_python_interpreter: /usr/bin/python
|
3
roles/tobiko-inventory/vars/test-inventory-RedHat.yaml
Normal file
3
roles/tobiko-inventory/vars/test-inventory-RedHat.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
|
||||
test_inventory_python_interpreter: /usr/libexec/platform-python
|
3
roles/tobiko-inventory/vars/test-inventory-Ubuntu.yaml
Normal file
3
roles/tobiko-inventory/vars/test-inventory-Ubuntu.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
|
||||
test_inventory_python_interpreter: /usr/bin/python3
|
@ -8,12 +8,20 @@
|
||||
description: |
|
||||
Run test cases using tobiko infrared plugin
|
||||
run: playbooks/infrared/run.yaml
|
||||
vars:
|
||||
test_collect_dir: '{{ zuul_output_dir }}/logs'
|
||||
test_inventory_file: '{{ zuul_work_dir }}/ansible_hosts'
|
||||
tox_envlist: infrared
|
||||
tox_extra_args: -- --host secondary --collect-dir {{ test_collect_dir | quote }}
|
||||
tox_environ:
|
||||
ANSIBLE_INVENTORY: '{{ test_inventory_file }}'
|
||||
zuul_output_dir: '{{ ansible_user_dir }}/zuul-output'
|
||||
|
||||
|
||||
- job:
|
||||
name: tobiko-tox-infrared-centos-7
|
||||
parent: tobiko-tox-infrared
|
||||
nodeset: centos-7
|
||||
nodeset: centos-7-2-node
|
||||
voting: false
|
||||
description: |
|
||||
Run py36 test cases using tobiko infrared plugin on CentOS 7
|
||||
@ -22,7 +30,7 @@
|
||||
- job:
|
||||
name: tobiko-tox-infrared-centos-8
|
||||
parent: tobiko-tox-infrared
|
||||
nodeset: centos-8
|
||||
nodeset: centos-8-2-node
|
||||
voting: false
|
||||
description: |
|
||||
Run py36 test cases using tobiko infrared plugin on CentOS 8
|
||||
@ -30,7 +38,7 @@
|
||||
- job:
|
||||
name: tobiko-tox-infrared-ubuntu-bionic
|
||||
parent: tobiko-tox-infrared
|
||||
nodeset: ubuntu-bionic
|
||||
nodeset: ubuntu-bionic-2-node
|
||||
voting: false
|
||||
description: |
|
||||
Run py36 test cases using tobiko infrared plugin on Ubuntu Bionic
|
||||
|
@ -1,33 +1,47 @@
|
||||
- nodeset:
|
||||
name: openstack-three-node-centos-7
|
||||
nodes:
|
||||
- name: controller
|
||||
label: centos-7
|
||||
- name: compute1
|
||||
label: centos-7
|
||||
- name: compute2
|
||||
label: centos-7
|
||||
groups:
|
||||
# Node where tests are executed and test results collected
|
||||
- name: tempest
|
||||
nodes:
|
||||
- controller
|
||||
# Nodes running the compute service
|
||||
- name: compute
|
||||
nodes:
|
||||
- compute1
|
||||
- compute2
|
||||
# Nodes that are not the controller
|
||||
- name: subnode
|
||||
nodes:
|
||||
- compute1
|
||||
- compute2
|
||||
# Switch node for multinode networking setup
|
||||
- name: switch
|
||||
nodes:
|
||||
- controller
|
||||
# Peer nodes for multinode networking setup
|
||||
- name: peers
|
||||
nodes:
|
||||
- compute1
|
||||
- compute2
|
||||
name: centos-8-2-node
|
||||
nodes:
|
||||
- name: primary
|
||||
label: centos-8
|
||||
- name: secondary
|
||||
label: centos-8
|
||||
groups:
|
||||
- name: subnodes
|
||||
nodes:
|
||||
- secondary
|
||||
|
||||
|
||||
- nodeset:
|
||||
name: openstack-three-node-centos-7
|
||||
nodes:
|
||||
- name: controller
|
||||
label: centos-7
|
||||
- name: compute1
|
||||
label: centos-7
|
||||
- name: compute2
|
||||
label: centos-7
|
||||
|
||||
groups:
|
||||
# Node where tests are executed and test results collected
|
||||
- name: tempest
|
||||
nodes:
|
||||
- controller
|
||||
# Nodes running the compute service
|
||||
- name: compute
|
||||
nodes:
|
||||
- compute1
|
||||
- compute2
|
||||
# Nodes that are not the controller
|
||||
- name: subnode
|
||||
nodes:
|
||||
- compute1
|
||||
- compute2
|
||||
# Switch node for multinode networking setup
|
||||
- name: switch
|
||||
nodes:
|
||||
- controller
|
||||
# Peer nodes for multinode networking setup
|
||||
- name: peers
|
||||
nodes:
|
||||
- compute1
|
||||
- compute2
|
||||
|
Loading…
Reference in New Issue
Block a user