Add install command to IR plugin

* Allow users and CI pipelines to run tobiko install command
* Users can specify which environment to use

Also:

* Removed os-fault configuration generation - this is done
  by Tobiko itself
* Remove other unused tasks

Change-Id: Ieeba8d4094cb3764a2a2de99debbac3acd886180
This commit is contained in:
abregman 2019-03-17 13:49:08 +02:00
parent 3ee4feee49
commit 641b627a7a
7 changed files with 49 additions and 110 deletions

27
infrared/install.yml Normal file
View File

@ -0,0 +1,27 @@
---
- 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,11 +1,3 @@
- name: Install Tobiko
import_playbook: tasks/install.yml
- name: Set up os-faults configuration
import_playbook: tasks/configure.yml
- name: Run Tobiko
import_playbook: tasks/run.yml
when:
- test.tests is defined
- test.tests
---
- import_playbook: install.yml
when: test.install|default(False)

View File

@ -4,12 +4,27 @@ config:
subparsers:
tobiko:
description: Tobiko Options
description: Executes Tobiko Framework
include_groups: ["Ansible options", "Inventory", "Common options", "Answers file"]
groups:
- title: Testing Parameters
- title: Stages Control
options:
tests:
install:
type: Bool
help: |
Install Tobiko
- title: Install Options
options:
env:
type: Value
help: |
Group of tests to execute
The tox environment to use
dir:
type: Value
help: |
The directory where Tobiko will be installed and used
venv:
type: Value
default: '~/tobiko_venv'
help: |
path of existing virtual environment

View File

@ -1,12 +0,0 @@
---
- name: Generate os-faults configuration
hosts: undercloud
any_errors_fatal: true
gather_facts: yes
tasks:
- name: Create os-faults configuration file
template:
src: "templates/os-faults.yaml.j2"
dest: "~/os-faults.yaml"
mode: 0755

View File

@ -1,37 +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: Clone Tobiko project
git:
repo: 'https://github.com/rhos-infra/tobiko'
dest: "~/tobiko"
- name: Create Virtualenv
pip:
virtualenv: "~/tobiko_venv"
name: "{{ item }}"
state: latest
with_items:
- pip
- setuptools
- pbr
- name: Install Tobiko
pip:
chdir: "~/tobiko"
virtualenv: "~/tobiko_venv"
name: "."
editable: true

View File

@ -1,11 +0,0 @@
---
- name: Run Tobiko
hosts: undercloud
any_errors_fatal: true
gather_facts: no
tasks:
- name: Run Tobiko Tests
shell: |
tobiko -e {{ test.tests }}

View File

@ -1,35 +0,0 @@
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