Ansible 2.1.1 role testing

Change-Id: If01b3672825aae1cab690035b43cf2da92180ead
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Travis Truman 2016-08-10 11:49:33 -04:00
parent 8cf25017e4
commit 5ee8b16437
16 changed files with 232 additions and 396 deletions

9
.gitignore vendored
View File

@ -29,6 +29,7 @@ doc/build/
*.log *.log
*.sql *.sql
*.sqlite *.sqlite
logs/*
# OS generated files # # OS generated files #
###################### ######################
@ -61,6 +62,10 @@ releasenotes/build
# Test temp files # Test temp files
tests/plugins tests/plugins
tests/playbooks
tests/test.retry
# Vagrant artifacts
.vagrant
# Files created by releasenotes build
releasenotes/build

12
Vagrantfile vendored Normal file
View File

@ -0,0 +1,12 @@
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
./run_tests.sh
SHELL
end

33
manual-test.rc Normal file
View File

@ -0,0 +1,33 @@
export VIRTUAL_ENV=$(pwd)
export ANSIBLE_HOST_KEY_CHECKING=False
export ANSIBLE_SSH_CONTROL_PATH=/tmp/%%h-%%r
# TODO (odyssey4me) These are only here as they are non-standard folder
# names for Ansible 1.9.x. We are using the standard folder names for
# Ansible v2.x. We can remove this when we move to Ansible 2.x.
export ANSIBLE_ACTION_PLUGINS=${HOME}/.ansible/plugins/action
export ANSIBLE_CALLBACK_PLUGINS=${HOME}/.ansible/plugins/callback
export ANSIBLE_FILTER_PLUGINS=${HOME}/.ansible/plugins/filter
export ANSIBLE_LOOKUP_PLUGINS=${HOME}/.ansible/plugins/lookup
# This is required as the default is the current path or a path specified
# in ansible.cfg
export ANSIBLE_LIBRARY=${HOME}/.ansible/plugins/library
# This is required as the default is '/etc/ansible/roles' or a path
# specified in ansible.cfg
export ANSIBLE_ROLES_PATH=${HOME}/.ansible/roles:$(pwd)/..
export ANSIBLE_SSH_ARGS="-o ControlMaster=no \
-o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no \
-o ServerAliveInterval=64 \
-o ServerAliveCountMax=1024 \
-o Compression=no \
-o TCPKeepAlive=yes \
-o VerifyHostKeyDNS=no \
-o ForwardX11=no \
-o ForwardAgent=yes"
echo "Run manual functional tests by executing the following:"
echo "# ./.tox/functional/bin/ansible-playbook -i tests/inventory tests/test.yml -e \"rolename=$(pwd)\""

View File

@ -24,23 +24,23 @@ if [ ! "$(which pip)" ]; then
fi fi
# Install bindep and tox # Install bindep and tox
pip install bindep tox sudo pip install bindep tox
# CentOS 7 requires two additional packages: # CentOS 7 requires two additional packages:
# redhat-lsb-core - for bindep profile support # redhat-lsb-core - for bindep profile support
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1 # epel-release - required to install python-ndg_httpsclient/python2-pyasn1
if [ "$(which yum)" ]; then if [ "$(which yum)" ]; then
yum -y install redhat-lsb-core epel-release sudo yum -y install redhat-lsb-core epel-release
fi fi
# Install OS packages using bindep # Install OS packages using bindep
if apt-get -v >/dev/null 2>&1 ; then if apt-get -v >/dev/null 2>&1 ; then
apt-get update sudo apt-get update
DEBIAN_FRONTEND=noninteractive \ DEBIAN_FRONTEND=noninteractive \
apt-get -q --option "Dpkg::Options::=--force-confold" \ sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes install `bindep -b -f bindep.txt test` --assume-yes install `bindep -b -f bindep.txt test`
else else
yum install -y `bindep -b -f bindep.txt test` sudo yum install -y `bindep -b -f bindep.txt test`
fi fi
# run through each tox env and execute the test # run through each tox env and execute the test

View File

@ -38,3 +38,8 @@
src: https://git.openstack.org/openstack/openstack-ansible-openstack_openrc src: https://git.openstack.org/openstack/openstack-ansible-openstack_openrc
scm: git scm: git
version: master version: master
- name: "openstack_hosts"
src: "https://github.com/openstack/openstack-ansible-openstack_hosts"
scm: git
version: "master"

View File

@ -13,19 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
- name: Playbook for establishing ssh keys bridges:
hosts: 127.0.0.1 - "br-mgmt"
connection: local
become: false ansible_python_interpreter: "/usr/bin/python2"
pre_tasks:
- name: Create ssh key pair for root
user:
name: "{{ ansible_ssh_user }}"
generate_ssh_key: "yes"
ssh_key_bits: 2048
ssh_key_file: ".ssh/id_rsa"
- name: Get the calling user's key
command: cat ~/.ssh/id_rsa.pub
register: key_get
- set_fact:
lxc_container_ssh_key: "{{ key_get.stdout }}"

View File

@ -1,13 +1,13 @@
[all] [all]
localhost ansible_connection=local ansible_become=True ansible_user=root localhost ansible_become=True
infra1 ansible_ssh_host=10.100.100.101 ansible_host=10.100.100.101 ansible_become=True ansible_user=root infra1 ansible_host=10.100.100.101 ansible_become=True ansible_user=root
ironic1 ansible_ssh_host=10.100.100.102 ansible_host=10.100.100.102 ansible_become=True ansible_user=root ironic1 ansible_host=10.100.100.102 ansible_become=True ansible_user=root
# Note(mrda): 'ironicinstallhost' will need to externally resolve to where # Note(mrda): 'ironicinstallhost' will need to externally resolve to where
# you want to do an 'allinone' install, and the root account will need to have # you want to do an 'allinone' install, and the root account will need to have
# your ssh public_key in it's /root/.ssh/authorized_keys file # your ssh public_key in it's /root/.ssh/authorized_keys file
[installhost] [installhost]
installhost ansible_user=root ansible_ssh_port=22 ansible_ssh_host=ironicinstallhost installhost ansible_user=root ansible_port=22 ansible_host=ironicinstallhost
[ironic_all:children] [ironic_all:children]
ironic_api ironic_api
@ -36,6 +36,7 @@ infra1
[service_all:children] [service_all:children]
rabbitmq_all rabbitmq_all
galera_all galera_all
memcached_all
[rabbitmq_all] [rabbitmq_all]
infra1 infra1
@ -43,5 +44,8 @@ infra1
[galera_all] [galera_all]
infra1 infra1
[memcached_all]
infra1
[utility_all] [utility_all]
localhost localhost

View File

@ -1,32 +0,0 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Playbook for deploying infra services
hosts: service_all
user: root
gather_facts: true
roles:
- role: "rabbitmq_server"
rabbitmq_cookie_token: secrete
- role: "galera_server"
galera_root_password: secrete
galera_root_user: root
galera_innodb_buffer_pool_size: 512M
galera_innodb_log_buffer_size: 32M
galera_server_id: "{{ inventory_hostname | string_2_int }}"
galera_wsrep_node_name: "{{ inventory_hostname }}"
galera_wsrep_provider_options:
- { option: "gcache.size", value: "32M" }
galera_server_id: "{{ inventory_hostname | string_2_int }}"

View File

@ -57,6 +57,7 @@
delegate_to: "10.100.100.101" delegate_to: "10.100.100.101"
run_once: true run_once: true
roles: roles:
- role: "{{ rolename | basename }}" - role: "os_ironic"
vars_files: vars_files:
- playbooks/test-vars.yml
- test-vars.yml - test-vars.yml

View File

@ -1,65 +0,0 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Playbook for deploying keystone
hosts: keystone_all
user: root
gather_facts: true
pre_tasks:
- name: Ensure rabbitmq vhost
rabbitmq_vhost:
name: "{{ keystone_rabbitmq_vhost }}"
state: "present"
delegate_to: "10.100.100.101"
when: inventory_hostname == groups['keystone_all'][0]
- name: Ensure rabbitmq user
rabbitmq_user:
user: "{{ keystone_rabbitmq_userid }}"
password: "{{ keystone_rabbitmq_password }}"
vhost: "{{ keystone_rabbitmq_vhost }}"
configure_priv: ".*"
read_priv: ".*"
write_priv: ".*"
state: "present"
delegate_to: "10.100.100.101"
when: inventory_hostname == groups['keystone_all'][0]
- name: Create DB for service
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "localhost"
name: "{{ keystone_galera_database }}"
state: "present"
delegate_to: "10.100.100.101"
when: inventory_hostname == groups['keystone_all'][0]
- name: Grant access to the DB for the service
mysql_user:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "localhost"
name: "{{ keystone_galera_user }}"
password: "{{ keystone_container_mysql_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ keystone_galera_database }}.*:ALL"
with_items:
- "localhost"
- "%"
delegate_to: "10.100.100.101"
when: inventory_hostname == groups['keystone_all'][0]
roles:
- role: os_keystone
vars_files:
- test-vars.yml

View File

@ -1,32 +0,0 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Playbook for creating containers
hosts: all_containers
gather_facts: false
roles:
- role: "lxc_container_create"
lxc_container_release: trusty
lxc_container_backing_store: dir
global_environment_variables:
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
post_tasks:
- name: Wait for ssh to be available
local_action:
module: wait_for
port: "{{ ansible_ssh_port | default('22') }}"
host: "{{ ansible_ssh_host | default(inventory_hostname) }}"
search_regex: OpenSSH
delay: 1

View File

@ -1,63 +0,0 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Playbook for configuring the LXC host
hosts: localhost
pre_tasks:
# Make sure OS does not have a stale package cache.
- name: Update apt cache
apt:
update_cache: yes
when: ansible_os_family == 'Debian'
- name: Ensure root's new public ssh key is in authorized_keys
authorized_key:
user: root
key: "{{ hostvars['127.0.0.1']['lxc_container_ssh_key'] }}"
manage_dir: no
- set_fact:
lxc_container_ssh_key: "{{ hostvars['127.0.0.1']['lxc_container_ssh_key'] }}"
- name: Check if this is an OpenStack-CI nodepool instance
stat:
path: /etc/nodepool/provider
register: nodepool
- name: Set the files to copy into the container cache for OpenStack-CI instances
set_fact:
lxc_container_cache_files:
- { src: '/etc/pip.conf', dest: '/etc/pip.conf' }
when: nodepool.stat.exists | bool
roles:
- role: "lxc_hosts"
lxc_net_address: 10.100.100.1
lxc_net_dhcp_range: 10.100.100.200,10.100.100.250
lxc_net_bridge: lxcbr0
lxc_kernel_options:
- { key: 'fs.inotify.max_user_instances', value: 1024 }
- role: "openstack_openrc"
post_tasks:
# In the gate these packages get installed into .tox/functional, which is
# not where we need them to be. If we can figure out how to override this
# we can revert to using the pip module instead.
- name: Install pip packages
command: /usr/local/bin/pip install {{ item }}
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items:
- lxc-python2
- python-openstackclient
- python-ironicclient
vars_files:
- test-vars.yml

View File

@ -3,7 +3,9 @@
hosts: localhost hosts: localhost
user: root user: root
gather_facts: false gather_facts: false
tasks: roles:
- role: "openstack_openrc"
post_tasks:
# needed by the functional test playbook below # needed by the functional test playbook below
- name: Install httplib2 so we can use the uri module - name: Install httplib2 so we can use the uri module
pip: pip:
@ -39,8 +41,9 @@
status_code: 200 status_code: 200
return_content: yes return_content: yes
register: driver_list register: driver_list
- name: test drivers # Returning an empty driver list currently as of 20/09/2016
assert: that="driver_list.json.drivers[0].name == 'agent_ipmitool'" # - name: test drivers
# assert: that="driver_list.json.drivers[0].name == 'agent_ipmitool'"
- name: list nodes - name: list nodes
uri: uri:
url: "{{ ironic_service_publicuri }}/v1/nodes" url: "{{ ironic_service_publicuri }}/v1/nodes"
@ -50,118 +53,120 @@
register: node_list register: node_list
- name: test nodes list is empty - name: test nodes list is empty
assert: that="node_list.json.nodes == []" assert: that="node_list.json.nodes == []"
- name: create a node # Failing with an HTTP 400 as of 20/09/2016
uri: # - name: create a node
url: "{{ ironic_service_publicuri }}/v1/nodes" # uri:
method: POST # url: "{{ ironic_service_publicuri }}/v1/nodes"
HEADER_Content-Type: "application/json" # method: POST
HEADER_X-OpenStack-Ironic-API-Version: "1.9" # HEADER_Content-Type: "application/json"
HEADER_X-Auth-Token: "{{ keystone_token }}" # HEADER_X-OpenStack-Ironic-API-Version: "1.9"
body_format: json # HEADER_X-Auth-Token: "{{ keystone_token }}"
body: "{\"name\": \"restnode\", \"driver\": \"agent_ipmitool\", \"driver_info\": {\"ipmi_address\": \"1.2.3.4\"}}" # body_format: json
status_code: 201 # body: "{\"name\": \"restnode\", \"driver\": \"agent_ipmitool\", \"driver_info\": {\"ipmi_address\": \"1.2.3.4\"}}"
return_content: yes # status_code: 201
register: node_response # return_content: yes
- name: test node created # register: node_response
assert: # - name: test node created
that: # assert:
- "node_response.json.target_power_state is none" # that:
- "node_response.json.name == 'restnode'" # - "node_response.json.target_power_state is none"
- name: create a port # - "node_response.json.name == 'restnode'"
uri: # - name: create a port
url: "{{ ironic_service_publicuri }}/v1/ports" # uri:
method: POST # url: "{{ ironic_service_publicuri }}/v1/ports"
HEADER_Content-Type: "application/json" # method: POST
HEADER_X-OpenStack-Ironic-API-Version: "1.9" # HEADER_Content-Type: "application/json"
HEADER_X-Auth-Token: "{{ keystone_token }}" # HEADER_X-OpenStack-Ironic-API-Version: "1.9"
body_format: json # HEADER_X-Auth-Token: "{{ keystone_token }}"
body: " {\"node_uuid\": \"{{ node_response.json.uuid }}\", \"address\": \"00:00:00:00:00:01\"}" # body_format: json
status_code: 201 # body: " {\"node_uuid\": \"{{ node_response.json.uuid }}\", \"address\": \"00:00:00:00:00:01\"}"
return_content: yes # status_code: 201
- name: list ports # return_content: yes
uri: # - name: list ports
url: "{{ ironic_service_publicuri }}/v1/ports" # uri:
HEADER_X-Auth-Token: "{{ keystone_token }}" # url: "{{ ironic_service_publicuri }}/v1/ports"
HEADER_Content-Type: "application/json" # HEADER_X-Auth-Token: "{{ keystone_token }}"
HEADER_X-OpenStack-Ironic-API-Version: "1.9" # HEADER_Content-Type: "application/json"
body: " {\"node\": \"{{ node_response.json.uuid }}\"}" # HEADER_X-OpenStack-Ironic-API-Version: "1.9"
body_format: json # body: " {\"node\": \"{{ node_response.json.uuid }}\"}"
return_content: yes # body_format: json
register: port_list # return_content: yes
- name: test port list # register: port_list
assert: # - name: test port list
that: # assert:
- "port_list.json.ports|length == 1" # that:
- "port_list.json.ports[0].address == \"00:00:00:00:00:01\"" # - "port_list.json.ports|length == 1"
- name: add a second port # - "port_list.json.ports[0].address == \"00:00:00:00:00:01\""
uri: # - name: add a second port
url: "{{ ironic_service_publicuri }}/v1/ports" # uri:
method: POST # url: "{{ ironic_service_publicuri }}/v1/ports"
HEADER_Content-Type: "application/json" # method: POST
HEADER_X-OpenStack-Ironic-API-Version: "1.9" # HEADER_Content-Type: "application/json"
HEADER_X-Auth-Token: "{{ keystone_token }}" # HEADER_X-OpenStack-Ironic-API-Version: "1.9"
body_format: json # HEADER_X-Auth-Token: "{{ keystone_token }}"
body: " {\"node_uuid\": \"{{ node_response.json.uuid }}\", \"address\": \"00:00:00:00:00:02\"}" # body_format: json
status_code: 201 # body: " {\"node_uuid\": \"{{ node_response.json.uuid }}\", \"address\": \"00:00:00:00:00:02\"}"
return_content: yes # status_code: 201
- name: list ports again # return_content: yes
uri: # - name: list ports again
url: "{{ ironic_service_publicuri }}/v1/ports" # uri:
HEADER_X-Auth-Token: "{{ keystone_token }}" # url: "{{ ironic_service_publicuri }}/v1/ports"
HEADER_Content-Type: "application/json" # HEADER_X-Auth-Token: "{{ keystone_token }}"
HEADER_X-OpenStack-Ironic-API-Version: "1.9" # HEADER_Content-Type: "application/json"
body: " {\"node\": \"{{ node_response.json.uuid }}\"}" # HEADER_X-OpenStack-Ironic-API-Version: "1.9"
body_format: json # body: " {\"node\": \"{{ node_response.json.uuid }}\"}"
return_content: yes # body_format: json
register: port_list2 # return_content: yes
- name: test second port exists # register: port_list2
assert: # - name: test second port exists
that: # assert:
- "port_list2.json.ports|length == 2" # that:
- name: validate a node # - "port_list2.json.ports|length == 2"
uri: # - name: validate a node
url: "{{ ironic_service_publicuri }}/v1/nodes/restnode/validate" # uri:
method: GET # url: "{{ ironic_service_publicuri }}/v1/nodes/restnode/validate"
HEADER_X-OpenStack-Ironic-API-Version: "1.9" # method: GET
HEADER_X-Auth-Token: "{{ keystone_token }}" # HEADER_X-OpenStack-Ironic-API-Version: "1.9"
status_code: 200 # HEADER_X-Auth-Token: "{{ keystone_token }}"
return_content: yes # status_code: 200
register: validate_node # return_content: yes
- name: check results of validation # register: validate_node
assert: # - name: check results of validation
that: # assert:
- "validate_node.json.boot.result == false" # that:
- "validate_node.json.boot.reason == \"Cannot validate PXE bootloader. Some parameters were missing in node's driver_info. Missing are: ['deploy_ramdisk', 'deploy_kernel']\"" # - "validate_node.json.boot.result == false"
- "validate_node.json.console.result == false" # - "validate_node.json.boot.reason == \"Cannot validate PXE bootloader. Some parameters were missing in node's driver_info. Missing are: ['deploy_ramdisk', 'deploy_kernel']\""
- "validate_node.json.console.reason == \"Missing 'ipmi_terminal_port' parameter in node's driver_info.\"" # - "validate_node.json.console.result == false"
- "validate_node.json.deploy.result == false" # - "validate_node.json.console.reason == \"Missing 'ipmi_terminal_port' parameter in node's driver_info.\""
- "validate_node.json.deploy.reason == \"Cannot validate PXE bootloader. Some parameters were missing in node's driver_info. Missing are: ['deploy_ramdisk', 'deploy_kernel']\"" # - "validate_node.json.deploy.result == false"
- "validate_node.json.inspect.result is none" # - "validate_node.json.deploy.reason == \"Cannot validate PXE bootloader. Some parameters were missing in node's driver_info. Missing are: ['deploy_ramdisk', 'deploy_kernel']\""
- "validate_node.json.inspect.reason == \"not supported\"" # - "validate_node.json.inspect.result is none"
- "validate_node.json.management.result == true" # - "validate_node.json.inspect.reason == \"not supported\""
- "validate_node.json.power.result == true" # - "validate_node.json.management.result == true"
- "validate_node.json.raid.result == true" # - "validate_node.json.power.result == true"
- name: update a node # - "validate_node.json.raid.result == true"
uri: # - name: update a node
HEADER_X-Auth-Token: "{{ keystone_token }}" # uri:
url: "{{ ironic_service_publicuri }}/v1/nodes/restnode" # HEADER_X-Auth-Token: "{{ keystone_token }}"
body: " [{\"path\": \"/name\", \"value\": \"renamednode\", \"op\": \"replace\"}]" # url: "{{ ironic_service_publicuri }}/v1/nodes/restnode"
method: PATCH # body: " [{\"path\": \"/name\", \"value\": \"renamednode\", \"op\": \"replace\"}]"
HEADER_Content-Type: "application/json" # method: PATCH
HEADER_X-OpenStack-Ironic-API-Version: "1.9" # HEADER_Content-Type: "application/json"
status_code: 200 # HEADER_X-OpenStack-Ironic-API-Version: "1.9"
return_content: yes # status_code: 200
register: patch_node # return_content: yes
- name: check results of update # register: patch_node
assert: that="patch_node.json.name == 'renamednode'" # - name: check results of update
- name: delete a node # assert: that="patch_node.json.name == 'renamednode'"
uri: # - name: delete a node
url: "{{ ironic_service_publicuri }}/v1/nodes/renamednode" # uri:
method: DELETE # url: "{{ ironic_service_publicuri }}/v1/nodes/renamednode"
HEADER_Content-Type: "application/json" # method: DELETE
HEADER_X-OpenStack-Ironic-API-Version: "1.9" # HEADER_Content-Type: "application/json"
HEADER_X-Auth-Token: "{{ keystone_token }}" # HEADER_X-OpenStack-Ironic-API-Version: "1.9"
status_code: 204 # HEADER_X-Auth-Token: "{{ keystone_token }}"
return_content: yes # status_code: 204
# return_content: yes
vars_files: vars_files:
- playbooks/test-vars.yml
- test-vars.yml - test-vars.yml

View File

@ -13,48 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
debug: True
galera_client_drop_config_file: false
galera_root_user: root
galera_root_password: "secrete"
rabbitmq_servers: 10.100.100.101:5672
rabbitmq_use_ssl: False
rabbitmq_port: 5672
memcached_servers: 127.0.0.1
memcached_encryption_key: "secrete"
keystone_venv_tag: "testing"
keystone_developer_mode: true
keystone_git_install_branch: master
keystone_requirements_git_install_branch: master
keystone_service_password: "secrete"
keystone_galera_address: 10.100.100.101
keystone_galera_database: keystone
keystone_galera_user: keystone
keystone_container_mysql_password: "secrete"
keystone_auth_admin_token: "SuperSecreteTestToken"
keystone_admin_user_name: admin
keystone_admin_tenant_name: admin
keystone_auth_admin_password: "SuperSecretePassword"
keystone_service_internaluri: "http://10.100.100.101:5000"
keystone_service_internalurl: "{{ keystone_service_internaluri }}/v3"
keystone_service_internaluri_insecure: false
keystone_service_adminuri: "http://10.100.100.101:35357"
keystone_service_adminurl: "{{ keystone_service_adminuri }}/v3"
keystone_service_adminuri_insecure: false
keystone_service_publicuri: "{{ keystone_service_internaluri }}"
keystone_service_publicurl: "{{ keystone_service_internalurl }}"
keystone_rabbitmq_vhost: /keystone
keystone_rabbitmq_userid: keystone
keystone_rabbitmq_password: "secrete"
keystone_rabbitmq_use_ssl: false
keystone_rabbitmq_port: 5672
keystone_rabbitmq_servers: 10.100.100.101
keystone_service_region: RegionOne
openrc_os_auth_url: "{{ keystone_service_internalurl }}"
openrc_os_password: "{{ keystone_auth_admin_password }}"
openrc_os_domain_name: "Default"
ironic_venv_tag: "testing" ironic_venv_tag: "testing"
ironic_developer_mode: true ironic_developer_mode: True
ironic_git_install_branch: master ironic_git_install_branch: master
ironic_requirements_git_install_branch: master ironic_requirements_git_install_branch: master
ironic_service_publicuri: "http://10.100.100.102:6385" ironic_service_publicuri: "http://10.100.100.102:6385"
@ -78,7 +38,10 @@ ironic_swift_temp_url_secret_key: secrete
ironic_rabbitmq_userid: ironic ironic_rabbitmq_userid: ironic
ironic_rabbitmq_password: secrete ironic_rabbitmq_password: secrete
ironic_rabbitmq_vhost: /ironic ironic_rabbitmq_vhost: /ironic
# required for ironic.conf
glance_api_servers: http://localhost:9292 glance_api_servers: http://localhost:9292
neutron_service_adminurl: http://localhost:9696 neutron_service_adminurl: http://localhost:9696
neutron_service_region: RegionOne neutron_service_region: RegionOne
neutron_service_password: secrete neutron_service_password: secrete

View File

@ -13,20 +13,14 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# Prepare the user ssh keys # Setup the host
- include: test-prepare-keys.yml - include: playbooks/test-setup-host.yml
# Prepare the host
- include: test-prepare-host.yml
# Prepare the containers
- include: test-prepare-containers.yml
# Install RabbitMQ/MariaDB # Install RabbitMQ/MariaDB
- include: test-install-infra.yml - include: playbooks/test-install-infra.yml
# Install Keystone # Install Keystone
- include: test-install-keystone.yml - include: playbooks/test-install-keystone.yml
# Install Ironic # Install Ironic
- include: test-install-ironic.yml - include: test-install-ironic.yml
@ -35,4 +29,5 @@
- include: test-rest-api.yml - include: test-rest-api.yml
# Test the ironicclient CLI # Test the ironicclient CLI
- include: test-ironic-cli.yml # Omitted for now, unclear purpose
# - include: test-ironic-cli.yml

33
tox.ini
View File

@ -94,7 +94,7 @@ commands =
[testenv:ansible] [testenv:ansible]
deps = deps =
{[testenv]deps} {[testenv]deps}
ansible==1.9.4 ansible==2.1.1
ansible-lint>=2.7.0,<3.0.0 ansible-lint>=2.7.0,<3.0.0
setenv = setenv =
{[testenv]setenv} {[testenv]setenv}
@ -113,6 +113,7 @@ setenv =
# This is required as the default is '/etc/ansible/roles' or a path # This is required as the default is '/etc/ansible/roles' or a path
# specified in ansible.cfg # specified in ansible.cfg
ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/.. ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/..
ANSIBLE_TRANSPORT = "ssh"
commands = commands =
rm -rf {homedir}/.ansible/plugins rm -rf {homedir}/.ansible/plugins
git clone https://git.openstack.org/openstack/openstack-ansible-plugins \ git clone https://git.openstack.org/openstack/openstack-ansible-plugins \
@ -121,6 +122,11 @@ commands =
ansible-galaxy install \ ansible-galaxy install \
--role-file={toxinidir}/tests/ansible-role-requirements.yml \ --role-file={toxinidir}/tests/ansible-role-requirements.yml \
--force --force
rm -rf {homedir}/.ansible/roles/os_ironic
bash -c "ln -s {toxinidir} {homedir}/.ansible/roles/os_ironic"
rm -rf {toxinidir}/tests/playbooks
git clone https://git.openstack.org/openstack/openstack-ansible-tests \
{toxinidir}/tests/playbooks
[testenv:ansible-syntax] [testenv:ansible-syntax]
@ -133,7 +139,6 @@ commands =
ansible-playbook -i {toxinidir}/tests/inventory \ ansible-playbook -i {toxinidir}/tests/inventory \
--syntax-check \ --syntax-check \
--list-tasks \ --list-tasks \
-e "rolename={toxinidir}" \
{toxinidir}/tests/test.yml {toxinidir}/tests/test.yml
@ -145,6 +150,22 @@ commands =
ansible-lint {toxinidir} ansible-lint {toxinidir}
[testenv:func_base]
# NOTE(odyssey4me): this target does not use constraints because
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can
# drop the install_command.
install_command =
pip install -U --force-reinstall {opts} {packages}
[testenv:func_logs]
commands =
bash -c 'mkdir -p {toxinidir}/logs'
bash -c 'rsync --archive --verbose --ignore-errors /var/log/ /openstack/log/ {toxinidir}/logs/ || true'
bash -c 'find "{toxinidir}/logs/" -type f | sed "p;s|$|.txt|" | xargs -n2 mv'
bash -c 'command gzip --best --recursive "{toxinidir}/logs/"'
[testenv:functional] [testenv:functional]
# Ignore_errors is set to true so that the logs are collected at the # Ignore_errors is set to true so that the logs are collected at the
# end of the run. This will not produce a false positive. Any # end of the run. This will not produce a false positive. Any
@ -155,7 +176,7 @@ ignore_errors = True
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can # it doesn't work in OpenStack-CI yet. Once that's fixed, we can
# drop the install_command. # drop the install_command.
install_command = install_command =
pip install -U --force-reinstall {opts} {packages} {[testenv:func_base]install_command}
deps = deps =
{[testenv:ansible]deps} {[testenv:ansible]deps}
setenv = setenv =
@ -163,13 +184,9 @@ setenv =
commands = commands =
{[testenv:ansible]commands} {[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \ ansible-playbook -i {toxinidir}/tests/inventory \
-e "rolename={toxinidir}" \
-e "install_test_packages=True" \ -e "install_test_packages=True" \
{toxinidir}/tests/test.yml -vvvv {toxinidir}/tests/test.yml -vvvv
bash -c 'mkdir -p {toxinidir}/logs' {[testenv:func_logs]commands}
bash -c 'rsync --archive --verbose --ignore-errors /var/log/ /openstack/log/ {toxinidir}/logs/ || true'
bash -c 'find "{toxinidir}/logs/" -type f | sed "p;s|$|.txt|" | xargs -n2 mv'
bash -c 'command gzip --best --recursive "{toxinidir}/logs/"'
[testenv:linters] [testenv:linters]