diff --git a/tests/ansible-role-requirements.yml b/tests/ansible-role-requirements.yml index f40ab8f7..6fc75a61 100644 --- a/tests/ansible-role-requirements.yml +++ b/tests/ansible-role-requirements.yml @@ -45,7 +45,7 @@ - name: os_previous_keystone src: https://git.openstack.org/openstack/openstack-ansible-os_keystone scm: git - version: stable/newton + version: stable/ocata - name: os_tempest src: https://git.openstack.org/openstack/openstack-ansible-os_tempest scm: git diff --git a/tests/keystone-test-vars.yml b/tests/keystone-test-vars.yml deleted file mode 100644 index c265400a..00000000 --- a/tests/keystone-test-vars.yml +++ /dev/null @@ -1,48 +0,0 @@ ---- -# Copyright 2017, 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. - -haproxy_default_services: - - service: - haproxy_service_name: galera - haproxy_backend_nodes: "{{ [groups['galera_all'][0]] | default([]) }}" # list expected - haproxy_backup_nodes: "{{ groups['galera_all'][1:] | default([]) }}" - haproxy_port: 3306 - haproxy_balance_type: tcp - haproxy_timeout_client: 5000s - haproxy_timeout_server: 5000s - haproxy_backend_options: - - "mysql-check user {{ galera_monitoring_user }}" - haproxy_whitelist_networks: - - 192.168.0.0/16 - - 172.16.0.0/12 - - 10.0.0.0/8 - - service: - haproxy_service_name: keystone_service - haproxy_backend_nodes: "{{ groups['keystone_all'] | default([]) }}" - haproxy_port: 5000 - haproxy_ssl: "{{ haproxy_ssl }}" - haproxy_balance_type: "http" - haproxy_backend_options: - - "httpchk HEAD /" - - service: - haproxy_service_name: keystone_admin - haproxy_backend_nodes: "{{ groups['keystone_all'] | default([]) }}" - haproxy_port: 35357 - haproxy_balance_type: "http" - haproxy_backend_options: - - "httpchk HEAD /" - -ssl_cipher_suite: "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS" -haproxy_ssl: false diff --git a/tests/os_keystone-overrides.yml b/tests/os_keystone-overrides.yml index 3f82b403..0c8dfae0 100644 --- a/tests/os_keystone-overrides.yml +++ b/tests/os_keystone-overrides.yml @@ -29,3 +29,38 @@ tempest_test_whitelist: external_lb_vip_address: 10.1.0.1 internal_lb_vip_address: 10.1.0.1 test_keystone_host: "{{ (keystone_upgrade is defined) | ternary(external_lb_vip_address, hostvars[groups[test_keystone_group][0]]['ansible_host']) }}" + +# For upgrades we need haproxy variables +haproxy_default_services: + - service: + haproxy_service_name: galera + haproxy_backend_nodes: "{{ [groups['galera_all'][0]] | default([]) }}" # list expected + haproxy_backup_nodes: "{{ groups['galera_all'][1:] | default([]) }}" + haproxy_port: 3306 + haproxy_balance_type: tcp + haproxy_timeout_client: 5000s + haproxy_timeout_server: 5000s + haproxy_backend_options: + - "mysql-check user {{ galera_monitoring_user }}" + haproxy_whitelist_networks: + - 192.168.0.0/16 + - 172.16.0.0/12 + - 10.0.0.0/8 + - service: + haproxy_service_name: keystone_service + haproxy_backend_nodes: "{{ groups['keystone_all'] | default([]) }}" + haproxy_port: 5000 + haproxy_ssl: "{{ haproxy_ssl }}" + haproxy_balance_type: "http" + haproxy_backend_options: + - "httpchk HEAD /" + - service: + haproxy_service_name: keystone_admin + haproxy_backend_nodes: "{{ groups['keystone_all'] | default([]) }}" + haproxy_port: 35357 + haproxy_balance_type: "http" + haproxy_backend_options: + - "httpchk HEAD /" + +ssl_cipher_suite: "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS" +haproxy_ssl: false diff --git a/tests/test-install-haproxy.yml b/tests/test-install-haproxy.yml index 69a4a718..f4b9a39b 100644 --- a/tests/test-install-haproxy.yml +++ b/tests/test-install-haproxy.yml @@ -19,4 +19,4 @@ - role: "haproxy_server" haproxy_service_configs: "{{ haproxy_default_services }}" vars_files: - - keystone-test-vars.yml + - os_keystone-overrides.yml diff --git a/tests/test-keystone-upgrades.sh b/tests/test-keystone-upgrades.sh new file mode 100755 index 00000000..94bbb85e --- /dev/null +++ b/tests/test-keystone-upgrades.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash + +# 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. + +# WARNING: +# This file is use by all OpenStack-Ansible roles for testing purposes. +# Any changes here will affect all OpenStack-Ansible role repositories +# with immediate effect. + +# PURPOSE: +# This script executes test Ansible playbooks required for performing +# an upgrade test of the os_neutron role. +# Due to the way Ansible caches and handles modules, we need to run +# separate Ansible runs to ensure the "upgrade" uses the new +# "neutron_migrations_facts" module, instead of the cached version +# used when deploying the previous Neutron version. + +## Shell Opts ---------------------------------------------------------------- + +set -e + +## Vars ---------------------------------------------------------------------- + +export WORKING_DIR=${WORKING_DIR:-$(pwd)} +export ROLE_NAME=${ROLE_NAME:-''} + +export ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-"-vvv"} +export TEST_PLAYBOOK=${TEST_PLAYBOOK:-$WORKING_DIR/tests/test-upgrade-pre.yml} +export TEST_CHECK_MODE=${TEST_CHECK_MODE:-false} +export TEST_IDEMPOTENCE=${TEST_IDEMPOTENCE:-false} +export COMMON_TESTS_PATH="${WORKING_DIR}/tests/common" + +echo "ANSIBLE_OVERRIDES: ${ANSIBLE_OVERRIDES}" +echo "ANSIBLE_PARAMETERS: ${ANSIBLE_PARAMETERS}" +echo "TEST_PLAYBOOK: ${TEST_PLAYBOOK}" +echo "TEST_CHECK_MODE: ${TEST_CHECK_MODE}" +echo "TEST_IDEMPOTENCE: ${TEST_IDEMPOTENCE}" + +## Functions ----------------------------------------------------------------- + +function execute_ansible_playbook { + + export ANSIBLE_CLI_PARAMETERS="${ANSIBLE_PARAMETERS} -e @${ANSIBLE_OVERRIDES}" + CMD_TO_EXECUTE="ansible-playbook ${TEST_PLAYBOOK} $@ ${ANSIBLE_CLI_PARAMETERS}" + + echo "Executing: ${CMD_TO_EXECUTE}" + echo "With:" + echo " ANSIBLE_INVENTORY: ${ANSIBLE_INVENTORY}" + echo " ANSIBLE_LOG_PATH: ${ANSIBLE_LOG_PATH}" + + ${CMD_TO_EXECUTE} + +} + +function gate_job_exit_tasks { + source "${COMMON_TESTS_PATH}/test-log-collect.sh" +} + +## Main ---------------------------------------------------------------------- + +# Ensure that the Ansible environment is properly prepared +source "${COMMON_TESTS_PATH}/test-ansible-env-prep.sh" + +# Set gate job exit traps, this is run regardless of exit state when the job finishes. +trap gate_job_exit_tasks EXIT + +# Prepare environment for the initial deploy of previous Keystone +# No upgrading or testing is done yet. +export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-upgrade-pre.yml" +export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-keystone-install.log" + +# Execute the setup of previous Keystone +execute_ansible_playbook + +# Prepare environment for the upgrade of Keystone +export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-upgrade-post.yml" +export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-keystone-upgrade.log" + +# Excute the upgrade of Keystone including testing/benchmarking +execute_ansible_playbook diff --git a/tests/test-upgrade-post.yml b/tests/test-upgrade-post.yml new file mode 100644 index 00000000..71af132c --- /dev/null +++ b/tests/test-upgrade-post.yml @@ -0,0 +1,32 @@ +--- +# Copyright 2017, 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. + +# This playbook handles the installation of current Keystone +# Benchmarking, and tempest testing. + +# Install upgrade benchmarking +- include: test-benchmark-keystone-upgrade.yml + +# Install Keystone +- include: common/test-install-keystone.yml + +# Install and execute Tempest +- include: common/test-install-tempest.yml + +# Test Keystone +- include: test-keystone-functional.yml + +# Test upgrade benchmarking results +- include: test-benchmark-keystone-upgrade-results.yml diff --git a/tests/test-upgrade.yml b/tests/test-upgrade-pre.yml similarity index 73% rename from tests/test-upgrade.yml rename to tests/test-upgrade-pre.yml index 349ce91e..76c36eea 100644 --- a/tests/test-upgrade.yml +++ b/tests/test-upgrade-pre.yml @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +# This playbook handles the deployment of the Infrastructure +# And the previous version of keystone. + # Prepare the user ssh keys - include: common/test-prepare-keys.yml @@ -30,18 +33,3 @@ # Install previous Keystone - include: test-install-previous-keystone.yml - -# Install upgrade benchmarking -- include: test-benchmark-keystone-upgrade.yml - -# Install Keystone -- include: common/test-install-keystone.yml - -# Install and execute Tempest -- include: common/test-install-tempest.yml - -# Test Keystone -- include: test-keystone-functional.yml - -# Test upgrade benchmarking results -- include: test-benchmark-keystone-upgrade-results.yml diff --git a/tox.ini b/tox.ini index 04a590fb..fca71a4b 100644 --- a/tox.ini +++ b/tox.ini @@ -114,15 +114,14 @@ deps = {[testenv:ansible]deps} setenv = {[testenv]setenv} - TEST_PLAYBOOK={toxinidir}/tests/test-upgrade.yml - ANSIBLE_PARAMETERS=-e keystone_upgrade=True + ANSIBLE_OVERRIDES={toxinidir}/tests/os_keystone-overrides.yml commands = {[testenv:tests_clone]commands} bash -c "if [ ! -d "{toxinidir}/tests/common/previous" ]; then \ git clone -b stable/ocata https://git.openstack.org/openstack/openstack-ansible-tests \ {toxinidir}/tests/common/previous; \ fi" - bash -c "{toxinidir}/tests/common/test-ansible-functional.sh" + bash -c "{toxinidir}/tests/test-keystone-upgrades.sh" [testenv:uw_apache]