diff --git a/.gitignore b/.gitignore index ca2ac14c..5f905f4f 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ doc/build/ *.log *.sql *.sqlite +logs/* # OS generated files # ###################### @@ -61,6 +62,10 @@ releasenotes/build # Test temp files tests/plugins +tests/playbooks +tests/*.retry -# Vagrant testing artifacts +# Vagrant artifacts .vagrant + + diff --git a/manual-test.rc b/manual-test.rc new file mode 100644 index 00000000..7016c453 --- /dev/null +++ b/manual-test.rc @@ -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" diff --git a/run_tests.sh b/run_tests.sh index 0a49aa3e..482a3894 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -24,23 +24,23 @@ if [ ! "$(which pip)" ]; then fi # Install bindep and tox -pip install bindep tox +sudo pip install bindep tox # CentOS 7 requires two additional packages: # redhat-lsb-core - for bindep profile support # epel-release - required to install python-ndg_httpsclient/python2-pyasn1 if [ "$(which yum)" ]; then - yum -y install redhat-lsb-core epel-release + sudo yum -y install redhat-lsb-core epel-release fi # Install OS packages using bindep if apt-get -v >/dev/null 2>&1 ; then - apt-get update + sudo apt-get update 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` else - yum install -y `bindep -b -f bindep.txt test` + sudo yum install -y `bindep -b -f bindep.txt test` fi # run through each tox env and execute the test diff --git a/templates/ceilometer.conf.j2 b/templates/ceilometer.conf.j2 index 3020c4e4..2285b43e 100644 --- a/templates/ceilometer.conf.j2 +++ b/templates/ceilometer.conf.j2 @@ -44,55 +44,55 @@ store_events = {{ not ceilometer_gnocchi_enabled | bool }} # Ceilometer needs to connect to it's own rabbitmq vhost {% for host in groups[ceilometer_rabbitmq_host_group] %} -messaging_urls = rabbit://{{ ceilometer_rabbitmq_userid }}:{{ ceilometer_rabbitmq_password }}@{{ hostvars[host]['ansible_ssh_host'] }}:{{ ceilometer_rabbitmq_port }}/{{ ceilometer_rabbitmq_vhost }} +messaging_urls = rabbit://{{ ceilometer_rabbitmq_userid }}:{{ ceilometer_rabbitmq_password }}@{{ hostvars[host]['ansible_host'] }}:{{ ceilometer_rabbitmq_port }}/{{ ceilometer_rabbitmq_vhost }} {% endfor %} {% if glance_ceilometer_enabled %} # Glance notifications {% for host in groups[glance_rabbitmq_telemetry_host_group] %} -messaging_urls = rabbit://{{ glance_rabbitmq_telemetry_userid }}:{{ glance_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_ssh_host'] }}:{{ glance_rabbitmq_telemetry_port }}/{{ glance_rabbitmq_telemetry_vhost }} +messaging_urls = rabbit://{{ glance_rabbitmq_telemetry_userid }}:{{ glance_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_host'] }}:{{ glance_rabbitmq_telemetry_port }}/{{ glance_rabbitmq_telemetry_vhost }} {% endfor %} {% endif %} {% if nova_ceilometer_enabled %} # Nova notifications {% for host in groups[nova_rabbitmq_telemetry_host_group] %} -messaging_urls = rabbit://{{ nova_rabbitmq_telemetry_userid }}:{{ nova_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_ssh_host'] }}:{{ nova_rabbitmq_telemetry_port }}/{{ nova_rabbitmq_telemetry_vhost }} +messaging_urls = rabbit://{{ nova_rabbitmq_telemetry_userid }}:{{ nova_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_host'] }}:{{ nova_rabbitmq_telemetry_port }}/{{ nova_rabbitmq_telemetry_vhost }} {% endfor %} {% endif %} {% if cinder_ceilometer_enabled %} # Cinder notifications {% for host in groups[cinder_rabbitmq_telemetry_host_group] %} -messaging_urls = rabbit://{{ cinder_rabbitmq_telemetry_userid }}:{{ cinder_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_ssh_host'] }}:{{ cinder_rabbitmq_telemetry_port }}/{{ cinder_rabbitmq_telemetry_vhost }} +messaging_urls = rabbit://{{ cinder_rabbitmq_telemetry_userid }}:{{ cinder_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_host'] }}:{{ cinder_rabbitmq_telemetry_port }}/{{ cinder_rabbitmq_telemetry_vhost }} {% endfor %} {% endif %} {% if neutron_ceilometer_enabled %} # Neutron notifications {% for host in groups[neutron_rabbitmq_telemetry_host_group] %} -messaging_urls = rabbit://{{ neutron_rabbitmq_telemetry_userid }}:{{ neutron_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_ssh_host'] }}:{{ neutron_rabbitmq_telemetry_port }}/{{ neutron_rabbitmq_telemetry_vhost }} +messaging_urls = rabbit://{{ neutron_rabbitmq_telemetry_userid }}:{{ neutron_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_host'] }}:{{ neutron_rabbitmq_telemetry_port }}/{{ neutron_rabbitmq_telemetry_vhost }} {% endfor %} {% endif %} {% if heat_ceilometer_enabled %} # Heat notifications {% for host in groups[heat_rabbitmq_telemetry_host_group] %} -messaging_urls = rabbit://{{ heat_rabbitmq_telemetry_userid }}:{{ heat_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_ssh_host'] }}:{{ heat_rabbitmq_telemetry_port }}/{{ heat_rabbitmq_telemetry_vhost }} +messaging_urls = rabbit://{{ heat_rabbitmq_telemetry_userid }}:{{ heat_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_host'] }}:{{ heat_rabbitmq_telemetry_port }}/{{ heat_rabbitmq_telemetry_vhost }} {% endfor %} {% endif %} {% if keystone_ceilometer_enabled %} # Keystone notifications {% for host in groups[keystone_rabbitmq_telemetry_host_group] %} -messaging_urls = rabbit://{{ keystone_rabbitmq_telemetry_userid }}:{{ keystone_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_ssh_host'] }}:{{ keystone_rabbitmq_telemetry_port }}/{{ keystone_rabbitmq_telemetry_vhost }} +messaging_urls = rabbit://{{ keystone_rabbitmq_telemetry_userid }}:{{ keystone_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_host'] }}:{{ keystone_rabbitmq_telemetry_port }}/{{ keystone_rabbitmq_telemetry_vhost }} {% endfor %} {% endif %} {% if sahara_ceilometer_enabled %} # Sahara notifications {% for host in groups[sahara_rabbitmq_telemetry_host_group] %} -messaging_urls = rabbit://{{ sahara_rabbitmq_telemetry_userid }}:{{ sahara_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_ssh_host'] }}:{{ sahara_rabbitmq_telemetry_port }}/{{ sahara_rabbitmq_telemetry_vhost }} +messaging_urls = rabbit://{{ sahara_rabbitmq_telemetry_userid }}:{{ sahara_rabbitmq_telemetry_password }}@{{ hostvars[host]['ansible_host'] }}:{{ sahara_rabbitmq_telemetry_port }}/{{ sahara_rabbitmq_telemetry_vhost }} {% endfor %} {% endif %} diff --git a/tests/ansible-role-requirements.yml b/tests/ansible-role-requirements.yml index b91abdfc..7c09a040 100644 --- a/tests/ansible-role-requirements.yml +++ b/tests/ansible-role-requirements.yml @@ -46,3 +46,8 @@ src: https://git.openstack.org/openstack/openstack-ansible-os_glance scm: git version: master +- name: "openstack_hosts" + src: "https://github.com/openstack/openstack-ansible-openstack_hosts" + scm: git + version: "master" + diff --git a/tests/group_vars/all_containers.yml b/tests/group_vars/all_containers.yml index 4cc97942..f37df47c 100644 --- a/tests/group_vars/all_containers.yml +++ b/tests/group_vars/all_containers.yml @@ -13,14 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -ansible_ssh_host: "{{ ansible_host }}" container_name: "{{ inventory_hostname }}" container_networks: management_address: address: "{{ ansible_host }}" - bridge: "lxcbr0" + bridge: "br-mgmt" interface: "eth1" - netmask: "255.255.252.0" + netmask: "255.255.255.0" type: "veth" physical_host: localhost properties: diff --git a/tests/test-install-tempest.yml b/tests/host_vars/localhost.yml similarity index 73% rename from tests/test-install-tempest.yml rename to tests/host_vars/localhost.yml index 201755ee..65ddeaa0 100644 --- a/tests/test-install-tempest.yml +++ b/tests/host_vars/localhost.yml @@ -1,5 +1,5 @@ --- -# Copyright 2015, Rackspace US, Inc. +# 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. @@ -13,11 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Playbook for deploying tempest - hosts: openstack1 - user: root - gather_facts: true - roles: - - role: "os_tempest" - vars_files: - - test-vars.yml +bridges: + - "br-mgmt" + +ansible_python_interpreter: "/usr/bin/python2" diff --git a/tests/inventory b/tests/inventory index f4a845d6..78082076 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,7 +1,7 @@ [all] -localhost ansible_connection=local ansible_become=True -infra1 ansible_ssh_host=10.100.100.2 ansible_host=10.100.100.2 ansible_become=True ansible_user=root -openstack1 ansible_ssh_host=10.100.100.3 ansible_host=10.100.100.3 ansible_become=True ansible_user=root +localhost ansible_become=True +infra1 ansible_host=10.100.100.2 ansible_become=True ansible_user=root +openstack1 ansible_host=10.100.100.3 ansible_become=True ansible_user=root [all_containers] infra1 @@ -13,9 +13,16 @@ infra1 [galera_all] infra1 +[memcached_all] +infra1 + [service_all:children] rabbitmq_all galera_all +memcached_all + +[utility_all] +infra1 [keystone_all] infra1 @@ -43,4 +50,7 @@ ceilometer_api ceilometer_collector ceilometer_agent_central ceilometer_agent_notification -ceilometer_agent_compute \ No newline at end of file +ceilometer_agent_compute + +[mongo_all] +openstack1 diff --git a/tests/test-functional-ceilometer.yml b/tests/test-functional-ceilometer.yml index d22bf962..a8016f0e 100644 --- a/tests/test-functional-ceilometer.yml +++ b/tests/test-functional-ceilometer.yml @@ -32,6 +32,15 @@ - result.status == 401 retries: 5 delay: 10 + vars_files: + - playbooks/test-vars.yml + - test-vars.yml + +- name: Playbook for tempest testing ceilometer + hosts: utility_all + user: root + gather_facts: false + tasks: - name: Run tempest shell: | . {{ tempest_bin }}/activate @@ -39,5 +48,6 @@ environment: RUN_TEMPEST_OPTS: "--serial" vars_files: + - playbooks/test-vars.yml - test-vars.yml diff --git a/tests/test-install-ceilometer.yml b/tests/test-install-ceilometer.yml index be059dcc..4306ce10 100644 --- a/tests/test-install-ceilometer.yml +++ b/tests/test-install-ceilometer.yml @@ -40,6 +40,7 @@ - inventory_hostname == groups['ceilometer_api'][0] - groups['rabbitmq_all']|length > 0 roles: - - role: "{{ rolename | basename }}" + - role: "os_ceilometer" vars_files: + - playbooks/test-vars.yml - test-vars.yml diff --git a/tests/test-install-glance.yml b/tests/test-install-glance.yml deleted file mode 100644 index 0b8899d8..00000000 --- a/tests/test-install-glance.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- -# Copyright 2015, 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 glance - hosts: glance_all - user: root - gather_facts: true - pre_tasks: - - name: Ensure rabbitmq vhost - rabbitmq_vhost: - name: "{{ glance_rabbitmq_vhost }}" - state: "present" - delegate_to: "10.100.100.2" - when: inventory_hostname == groups['glance_all'][0] - - name: Ensure rabbitmq user - rabbitmq_user: - user: "{{ glance_rabbitmq_userid }}" - password: "{{ glance_rabbitmq_password }}" - vhost: "{{ glance_rabbitmq_vhost }}" - configure_priv: ".*" - read_priv: ".*" - write_priv: ".*" - state: "present" - delegate_to: "10.100.100.2" - when: inventory_hostname == groups['glance_all'][0] - - name: Create DB for service - mysql_db: - login_user: "root" - login_password: "secrete" - login_host: "localhost" - name: "{{ glance_galera_database }}" - state: "present" - delegate_to: "10.100.100.2" - when: inventory_hostname == groups['glance_all'][0] - - name: Grant access to the DB for the service - mysql_user: - login_user: "root" - login_password: "secrete" - login_host: "localhost" - name: "{{ glance_galera_database }}" - password: "{{ glance_container_mysql_password }}" - host: "{{ item }}" - state: "present" - priv: "{{ glance_galera_database }}.*:ALL" - with_items: - - "localhost" - - "%" - delegate_to: "10.100.100.2" - when: inventory_hostname == groups['glance_all'][0] - roles: - - role: os_glance - vars_files: - - test-vars.yml diff --git a/tests/test-install-keystone.yml b/tests/test-install-keystone.yml deleted file mode 100644 index a99526d6..00000000 --- a/tests/test-install-keystone.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- -# Copyright 2015, 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.2" - 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.2" - when: inventory_hostname == groups['keystone_all'][0] - - name: Create DB for service - mysql_db: - login_user: "root" - login_password: "secrete" - login_host: "localhost" - name: "{{ keystone_galera_database }}" - state: "present" - delegate_to: "10.100.100.2" - when: inventory_hostname == groups['keystone_all'][0] - - name: Grant access to the DB for the service - mysql_user: - login_user: "root" - login_password: "secrete" - login_host: "localhost" - name: "{{ keystone_galera_database }}" - password: "{{ keystone_container_mysql_password }}" - host: "{{ item }}" - state: "present" - priv: "{{ keystone_galera_database }}.*:ALL" - with_items: - - "localhost" - - "%" - delegate_to: "10.100.100.2" - when: inventory_hostname == groups['keystone_all'][0] - roles: - - role: os_keystone - vars_files: - - test-vars.yml diff --git a/tests/test-install-infra.yml b/tests/test-install-mongodb.yml similarity index 66% rename from tests/test-install-infra.yml rename to tests/test-install-mongodb.yml index 2351f159..7c7979cd 100644 --- a/tests/test-install-infra.yml +++ b/tests/test-install-mongodb.yml @@ -13,28 +13,31 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Playbook for deploying infra services - hosts: service_all +- name: Install MongoDB for ceilometer + hosts: mongo_all user: root - gather_facts: true - pre_tasks: - - name: Install MongoDB packages + + tasks: + - name: Install mongo packages apt: - name: "{{ item }}" state: present + name: "{{ item }}" with_items: "{{ packages_mongodb }}" + - name: Configure the MongoDB bind address lineinfile: dest: /etc/mongodb.conf regexp: "^(#)?bind_ip" - line: "bind_ip = 10.100.100.2" + line: "bind_ip = {{ ansible_host }}" register: mongodb_bind + - name: Enable the MongoDB smallfiles option lineinfile: dest: /etc/mongodb.conf regexp: "^(#)?smallfiles" line: "smallfiles = true" register: mongodb_smallfiles + - name: Restart mongodb service: name: mongodb @@ -42,41 +45,45 @@ when: - mongodb_bind | changed or mongodb_smallfiles | changed register: mongodb_restart + - name: Wait for mongodb to come back online after the restart wait_for: - host: "10.100.100.2" + host: "{{ ansible_host }}" port: 27017 delay: 5 timeout: 30 when: - mongodb_restart is defined - mongodb_restart | changed + - name: Test mongodb connectivity - command: "mongo --host 10.100.100.2 --eval ' '" + command: "mongo --host {{ ansible_ssh_host }} --eval ' '" changed_when: False + + - name: Add admin user + mongodb_user: + login_host: "{{ ansible_host }}" + database: admin + name: root + password: "{{ ceilometer_container_db_password }}" + roles: 'root' + state: present + ignore_errors: True + - name: Add ceilometer database user mongodb_user: - login_host: "10.100.100.2" - database: ceilometer - name: ceilometer - password: secrete + login_host: "{{ ansible_host }}" + login_user: "root" + login_password: "{{ ceilometer_container_db_password }}" + database: "ceilometer" + name: "{{ ceilometer_database_user }}" + password: "{{ ceilometer_container_db_password }}" roles: 'readWrite,dbAdmin' state: present - 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 }}" vars: packages_mongodb: - mongodb-clients - mongodb-server - python-pymongo + ceilometer_database_name: ceilometer + ceilometer_database_user: ceilometer \ No newline at end of file diff --git a/tests/test-prepare-containers.yml b/tests/test-prepare-containers.yml deleted file mode 100644 index cf46e8ab..00000000 --- a/tests/test-prepare-containers.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -# Copyright 2015, 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 - connection: local - 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 diff --git a/tests/test-prepare-host.yml b/tests/test-prepare-host.yml deleted file mode 100644 index f8926411..00000000 --- a/tests/test-prepare-host.yml +++ /dev/null @@ -1,46 +0,0 @@ ---- -# Copyright 2015, 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 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['localhost']['lxc_container_ssh_key'] }}" - manage_dir: no - - set_fact: - lxc_container_ssh_key: "{{ hostvars['localhost']['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.8,10.100.100.253 - lxc_net_bridge: lxcbr0 - lxc_kernel_options: - - { key: 'fs.inotify.max_user_instances', value: 1024 } diff --git a/tests/test-prepare-keys.yml b/tests/test-prepare-keys.yml deleted file mode 100644 index a4fad4f5..00000000 --- a/tests/test-prepare-keys.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -# Copyright 2015, 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. - -# NOTE: we use become_user because setting become: no or become: false -# doesn't seem to override the ansible_become=true in the -# inventory -- name: Playbook for establishing ssh keys - hosts: localhost - become_user: "{{ ansible_ssh_user }}" - 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 }}" diff --git a/tests/test-vars.yml b/tests/test-vars.yml index 7b194a49..12d24444 100644 --- a/tests/test-vars.yml +++ b/tests/test-vars.yml @@ -13,127 +13,41 @@ # See the License for the specific language governing permissions and # limitations under the License. -internal_lb_vip_address: 10.100.100.2 -external_lb_vip_address: 10.100.100.2 - -galera_client_drop_config_file: false -galera_root_password: "secrete" -galera_root_user: "root" - -# Glance specific settings -glance_service_publicuri: "http://{{ hostvars[groups['glance_all'][0]]['ansible_ssh_host'] }}:9292" -glance_service_publicurl: "{{ glance_service_publicuri }}" -glance_service_internaluri: "http://{{ hostvars[groups['glance_all'][0]]['ansible_ssh_host'] }}:9292" -glance_service_internalurl: "{{ glance_service_internaluri }}" -glance_service_adminuri: "http://{{ hostvars[groups['glance_all'][0]]['ansible_ssh_host'] }}:9292" -glance_service_adminurl: "{{ glance_service_adminuri }}" -glance_container_mysql_password: "SuperSecrete" -glance_developer_mode: true -glance_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_ssh_host'] }}" -glance_galera_database: glance -glance_git_install_branch: master -glance_profiler_hmac_key: "secrete" -# RPC -glance_rabbitmq_password: "secrete" -glance_rabbitmq_userid: glance -glance_rabbitmq_vhost: /glance -glance_rabbitmq_port: 5672 -glance_rabbitmq_host_group: rabbitmq_all -# Telemetry notifications -glance_rabbitmq_telemetry_userid: "{{ glance_rabbitmq_userid }}" -glance_rabbitmq_telemetry_password: "{{ glance_rabbitmq_password }}" -glance_rabbitmq_telemetry_vhost: "{{ glance_rabbitmq_vhost }}" -glance_rabbitmq_telemetry_port: "{{ glance_rabbitmq_port }}" -glance_rabbitmq_telemetry_servers: "{{ glance_rabbitmq_servers }}" -glance_rabbitmq_telemetry_use_ssl: "{{ glance_rabbitmq_use_ssl }}" -glance_rabbitmq_telemetry_host_group: "{{ glance_rabbitmq_host_group }}" - -glance_requirements_git_install_branch: master -glance_service_password: "secrete" -glance_venv_tag: "testing" -glance_host: "{{ hostvars[groups['glance_all'][0]]['ansible_ssh_host'] }}" -glance_service_port: 9292 -glance_ceilometer_enabled: True - -keystone_galera_address: 10.100.100.2 -keystone_galera_database: keystone -keystone_venv_tag: "testing" -keystone_developer_mode: true -keystone_git_install_branch: master -keystone_requirements_git_install_branch: master -keystone_admin_user_name: admin -keystone_admin_tenant_name: admin -keystone_auth_admin_token: "SuperSecreteTestToken" -keystone_auth_admin_password: "SuperSecretePassword" -keystone_service_password: "secrete" -keystone_rabbitmq_password: "secrete" -keystone_container_mysql_password: "SuperSecrete" -keystone_service_adminuri_insecure: false -keystone_service_internaluri_insecure: false -keystone_service_internaluri: "http://{{ internal_lb_vip_address }}:5000" -keystone_service_internalurl: "{{ keystone_service_internaluri }}/v3" -keystone_service_adminuri: "http://{{ internal_lb_vip_address }}:35357" -keystone_service_adminurl: "{{ keystone_service_adminuri }}/v3" -keystone_service_region: RegionOne -keystone_rabbitmq_port: 5672 -keystone_rabbitmq_userid: keystone -keystone_rabbitmq_vhost: /keystone -keystone_rabbitmq_servers: 10.100.100.2 -keystone_rabbitmq_use_ssl: false - -rabbitmq_servers: 10.100.100.2 -rabbitmq_use_ssl: true -rabbitmq_port: 5671 - -memcached_servers: 127.0.0.1 -memcached_encryption_key: "secrete" - -ceilometer_db_ip: 10.100.100.2 -ceilometer_service_publicuri: "http://{{ hostvars[groups['ceilometer_all'][0]]['ansible_ssh_host'] }}:8777" +ceilometer_db_ip: "{{ hostvars[groups['mongo_all'][0]]['ansible_host'] }}" +ceilometer_service_publicuri: "http://{{ hostvars[groups['ceilometer_all'][0]]['ansible_host'] }}:8777" ceilometer_service_publicurl: "{{ ceilometer_service_publicuri }}" -ceilometer_service_internaluri: "http://{{ hostvars[groups['ceilometer_all'][0]]['ansible_ssh_host'] }}:8777" +ceilometer_service_internaluri: "http://{{ hostvars[groups['ceilometer_all'][0]]['ansible_host'] }}:8777" ceilometer_service_internalurl: "{{ ceilometer_service_internaluri }}" -ceilometer_service_adminuri: "http://{{ hostvars[groups['ceilometer_all'][0]]['ansible_ssh_host'] }}:8777" +ceilometer_service_adminuri: "http://{{ hostvars[groups['ceilometer_all'][0]]['ansible_host'] }}:8777" ceilometer_service_adminurl: "{{ ceilometer_service_adminuri }}" ceilometer_rabbitmq_userid: ceilometer ceilometer_rabbitmq_password: secrete ceilometer_rabbitmq_vhost: /ceilometer ceilometer_rabbitmq_servers: "{{ rabbitmq_servers }}" ceilometer_venv_tag: "testing" -ceilometer_developer_mode: true +ceilometer_developer_mode: True ceilometer_git_install_branch: master ceilometer_requirements_git_install_branch: master ceilometer_service_password: secrete ceilometer_telemetry_secret: secrete ceilometer_container_db_password: secrete +# Tempest testing relies on glance notifications +glance_ceilometer_enabled: True +glance_rabbitmq_telemetry_host_group: rabbitmq_all +glance_rabbitmq_telemetry_userid: glance +glance_rabbitmq_telemetry_password: "{{ rabbitmq_password }}" +glance_rabbitmq_telemetry_port: "{{ rabbitmq_port }}" +glance_rabbitmq_telemetry_vhost: "/glance" + +# Used by the ceilometer role swift_system_user_name: swift swift_system_shell: /bin/false swift_system_comment: swift test user swift_system_home_folder: "/var/lib/{{ swift_system_user_name }}" -openrc_os_password: "{{ keystone_auth_admin_password }}" -openrc_os_domain_name: "Default" -openrc_os_auth_url: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_ssh_host'] }}:5000/v3" -tempest_developer_mode: True -tempest_git_install_branch: master -tempest_venv_tag: "{{ tempest_git_install_branch }}" -# tempest_bin is the same as the default in os_tempest role, but we set -# it again here so we can refer to it in test-aodh-functional.yml tempest_bin: "/opt/tempest_{{ tempest_venv_tag }}/bin" -tempest_log_dir: "/var/log/" -tempest_main_group: ceilometer_all -tempest_service_available_aodh: False -tempest_service_available_ceilometer: True -tempest_service_available_cinder: False -tempest_service_available_glance: True -tempest_service_available_heat: False -tempest_service_available_horizon: False -tempest_service_available_neutron: False -tempest_service_available_nova: False -tempest_service_available_swift: False - tempest_pip_packages: - tempest - junitxml diff --git a/tests/test.yml b/tests/test.yml index d4e0ff3f..8582037d 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -13,21 +13,23 @@ # See the License for the specific language governing permissions and # limitations under the License. -- include: test-prepare-keys.yml +# Setup the host +- include: playbooks/test-setup-host.yml -- include: test-prepare-host.yml +# Install RabbitMQ/MariaDB +- include: playbooks/test-install-infra.yml -- include: test-prepare-containers.yml - -- include: test-install-infra.yml - -- include: test-install-keystone.yml +# Install Keystone +- include: playbooks/test-install-keystone.yml # Needed in order to run Ceilometer Tempest test -- include: test-install-glance.yml +- include: playbooks/test-install-glance.yml + +# Ceilometer metric data backend +- include: test-install-mongodb.yml - include: test-install-ceilometer.yml -- include: test-install-tempest.yml +- include: playbooks/test-install-tempest.yml - include: test-functional-ceilometer.yml diff --git a/tox.ini b/tox.ini index 55a5f118..92e76fbe 100644 --- a/tox.ini +++ b/tox.ini @@ -94,7 +94,7 @@ commands = [testenv:ansible] deps = {[testenv]deps} - ansible==1.9.4 + ansible==2.1.1 ansible-lint>=2.7.0,<3.0.0 setenv = {[testenv]setenv} @@ -113,6 +113,7 @@ setenv = # This is required as the default is '/etc/ansible/roles' or a path # specified in ansible.cfg ANSIBLE_ROLES_PATH = {homedir}/.ansible/roles:{toxinidir}/.. + ANSIBLE_TRANSPORT = "ssh" commands = rm -rf {homedir}/.ansible/plugins git clone https://git.openstack.org/openstack/openstack-ansible-plugins \ @@ -121,6 +122,11 @@ commands = ansible-galaxy install \ --role-file={toxinidir}/tests/ansible-role-requirements.yml \ --force + rm -rf {homedir}/.ansible/roles/os_ceilometer + bash -c "ln -s {toxinidir} {homedir}/.ansible/roles/os_ceilometer" + rm -rf {toxinidir}/tests/playbooks + git clone https://git.openstack.org/openstack/openstack-ansible-tests \ + {toxinidir}/tests/playbooks [testenv:ansible-syntax] @@ -133,7 +139,6 @@ commands = ansible-playbook -i {toxinidir}/tests/inventory \ --syntax-check \ --list-tasks \ - -e "rolename={toxinidir}" \ {toxinidir}/tests/test.yml @@ -145,6 +150,22 @@ commands = 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] # 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 @@ -155,7 +176,7 @@ ignore_errors = True # 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_base]install_command} deps = {[testenv:ansible]deps} setenv = @@ -163,13 +184,10 @@ setenv = commands = {[testenv:ansible]commands} ansible-playbook -i {toxinidir}/tests/inventory \ - -e "rolename={toxinidir}" \ + -e @{toxinidir}/tests/test-vars.yml \ -e "install_test_packages=True" \ {toxinidir}/tests/test.yml -vvvv - 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:func_logs]commands} [testenv:linters]