Add infrared plugin to tobiko

Work is based on Arie's initial IR-tobiko plugin, thanks ...:)

Change-Id: I9dfa8a87e8ca8623d347b06e1818612ea66c5580
This commit is contained in:
pkomarov 2019-05-07 11:29:58 +03:00 committed by Federico Ressi
parent 879293054b
commit ede95b9b42
9 changed files with 158 additions and 35 deletions

11
infrared/README.md Normal file
View File

@ -0,0 +1,11 @@
# Tobiko
Tobiko InfraRed Plugin
Tobiko was created for testing OpenStack Upgrades.
You can find the official project right [here](https://github.com/openstack/tobiko)
## Usage
infrared tobiko --tests neutron

View File

@ -1,27 +0,0 @@
---
- name: Install Tobiko
hosts: undercloud
any_errors_fatal: true
gather_facts: yes
tasks:
- name: Install required packages
become: yes
yum:
name: "{{ item }}"
state: present
with_items:
- 'python-virtualenv'
- 'git'
- name: Create Virtualenv
vars:
packages: ['pip', 'setuptools', 'pbr', 'tox']
pip:
virtualenv: "{{ test.venv }}"
name: "{{ packages }}"
state: latest
- name: Create virtual env for Tobiko test cases
shell: |
"source {{ test.venv }}/bin/activate"
"tox -e {{ test.environment }} --notest"

View File

@ -1,3 +1,16 @@
---
- import_playbook: install.yml
when: test.install|default(False)
- name: Tobiko Tests Main
hosts: undercloud
gather_facts: yes
any_errors_fatal: yes
tasks:
- name: Install Tobiko
include_tasks: tasks/install.yml
- name: Set up environment configurations
include_tasks: tasks/configure.yml
- name: Run Tobiko
include_tasks: tasks/run.yml
when:
- test.tests is defined

View File

@ -0,0 +1,34 @@
- name: Create os-faults configuration file
template:
src: "templates/os-faults.yaml.j2"
dest: "~/os-faults.yaml"
mode: 0755
- name: Set up Overcloud resources wget cirros img
shell: |
source "{{ test.overcloudrc }}"
wget -c http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
- name: Set up Overcloud resources create cirros img
shell: |
source "{{ test.overcloudrc }}"
openstack image create cirros \
--file cirros-0.4.0-x86_64-disk.img \
--disk-format qcow2 \
--container-format bare \
--public
- name: Set up Overcloud resources create m.tiny flavor
shell: |
source "{{ test.overcloudrc }}"
openstack flavor create --vcpus 1 --ram 64 --disk 1 m1.tiny
- name: Set up Overcloud resources create ssh keys
shell: |
test -f ~/.ssh/id_rsa||ssh-keygen -f ~/.ssh/id_rsa -P ''
- name: Create tobiko configuration file
template:
src: "templates/tobiko.conf.j2"
dest: "{{ test.dir }}/tobiko.conf"
mode: 0755

View File

@ -0,0 +1,33 @@
- name: Install pip using get-pip.py
become: yes
shell: |
curl https://bootstrap.pypa.io/get-pip.py | python
- name: Install required packages
become: yes
vars:
required_packages: ['python-virtualenv', 'git', 'gcc', 'python-devel']
yum:
name: "{{ required_packages }}"
state: present
- name: Clone Tobiko project
git:
repo: 'https://review.opendev.org/x/tobiko'
dest: "{{ test.dir }}"
- name: Create Virtualenv
vars:
packages: ['pip', 'setuptools', 'tox']
pip:
virtualenv: "{{ test.venv }}"
name: "{{ packages }}"
state: latest
- name: Install Tobiko
pip:
chdir: "{{ test.dir }}"
name: "."
virtualenv: "{{ test.venv }}"
editable: true
extra_args: "-c https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt -r {{ test.dir }}/requirements.txt"

6
infrared/tasks/run.yml Normal file
View File

@ -0,0 +1,6 @@
- name: Run Tobiko Tests
shell: |
cd "{{ test.dir }}"
source "{{ test.overcloudrc }}"
source "{{ test.venv }}/bin/activate"
tox -e "{{ test.tests }}"

View File

@ -0,0 +1,35 @@
cloud_management:
driver: universal
node_discover:
driver: node_list
args:
{% for host_name in groups.overcloud_nodes|sort %}
- fqdn: {{ host_name }}
ip: {{ hostvars[host_name]['ansible_host'] }}
auth:
username: heat-admin
private_key_file: /home/stack/.ssh/id_rsa
become: true
{% endfor %}
services:
openvswitch:
driver: system_service
args:
service_name: openvswitch
grep: openvswitch
containers:
neutron_ovs_agent:
driver: docker_container
args:
container_name: neutron_ovs_agent
neutron_metadata_agent:
driver: docker_container
args:
container_name: neutron_metadata_agent
neutron_api:
driver: docker_container
args:
container_name: neutron_api

View File

@ -0,0 +1,10 @@
[DEFAULT]
debug = true
log_file = tobiko.log
log_dir = .
[nova]
image = cirros
flavor = m1.tiny
key_file=~/.ssh/id_rsa
[neutron]
floating_network = public

View File

@ -1,6 +1,7 @@
---
config:
plugin_type: test
entry_point: ./infrared/main.yml
subparsers:
tobiko:
@ -15,16 +16,23 @@ subparsers:
Install Tobiko
- title: Install Options
options:
env:
type: Value
help: |
The tox environment to use
dir:
type: Value
default: "{{ ansible_env.HOME }}/tobiko"
help: |
The directory where Tobiko will be installed and used
overcloudrc:
type: Value
default: "{{ ansible_env.HOME }}/overcloudrc"
help: |
The path to the overcloudrc file
venv:
type: Value
default: '~/tobiko_venv'
default: "{{ ansible_env.HOME }}/tobiko_venv"
help: |
path of existing virtual environment
tests:
type: Value
help: |
The set of tests to execute
default: neutron