Provide framework for integration testing with run_tests.sh
The goal is to get run_tests.sh in a shape where it can be used and implemented in a jenkins gate job to eventually get packstack to gate against itself. The scenarios provided in the test matrix aligns with the ones that are integration tested in puppet-openstack for the sake of standardization. Change-Id: I68673a1f7e0584916a814296c9184b927a30aab6
This commit is contained in:
		
							
								
								
									
										47
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								README.md
									
									
									
									
									
								
							@@ -174,3 +174,50 @@ need to go inside those directories to run puppet-lint !
 | 
			
		||||
    $ export GEM_HOME=vendor
 | 
			
		||||
    $ bundle install
 | 
			
		||||
    $ bundle exec rake lint
 | 
			
		||||
 | 
			
		||||
## Packstack integration tests
 | 
			
		||||
 | 
			
		||||
Packstack is integration tested in the OpenStack gate and provides the means to
 | 
			
		||||
reproduce these tests on your environment if you wish.
 | 
			
		||||
 | 
			
		||||
This is the current matrix of available tests:
 | 
			
		||||
 | 
			
		||||
|     -      | scenario001 | scenario002 |
 | 
			
		||||
|:----------:|:-----------:|:-----------:|
 | 
			
		||||
| keystone   |      X      |       X     |
 | 
			
		||||
| glance     |      X      |       X     |
 | 
			
		||||
| nova       |      X      |       X     |
 | 
			
		||||
| neutron    |      X      |       X     |
 | 
			
		||||
| cinder     |      X      |             |
 | 
			
		||||
| ceilometer |      X      |             |
 | 
			
		||||
| aodh       |      X      |             |
 | 
			
		||||
| heat       |             |       X     |
 | 
			
		||||
| swift      |             |       X     |
 | 
			
		||||
| sahara     |             |       X     |
 | 
			
		||||
| trove      |             |       X     |
 | 
			
		||||
| horizon    |             |       X     |
 | 
			
		||||
| manila     |      X      |             |
 | 
			
		||||
| nagios     |      X      |             |
 | 
			
		||||
 | 
			
		||||
To run these tests:
 | 
			
		||||
 | 
			
		||||
    export SCENARIO="scenario001"
 | 
			
		||||
    ./run_tests.sh
 | 
			
		||||
 | 
			
		||||
run_tests.sh will take care of installing the required dependencies,
 | 
			
		||||
configure packstack to run according to the above matrix and run the complete
 | 
			
		||||
installation process. If the installation is successful, tempest will also
 | 
			
		||||
run smoke tests.
 | 
			
		||||
 | 
			
		||||
By default, run_tests.sh will set up delorean (RDO Trunk) repositories.
 | 
			
		||||
There are two ways of overriding default repositories:
 | 
			
		||||
 | 
			
		||||
    export DELOREAN="http://someotherdomain.tld/delorean.repo"
 | 
			
		||||
    export DELOREAN_DEPS="http://someotherdomain.tld/delorean-deps.repo"
 | 
			
		||||
    ./run_tests.sh
 | 
			
		||||
 | 
			
		||||
You can also choose to disable repository management entirely:
 | 
			
		||||
 | 
			
		||||
    <setup your own custom repositories here>
 | 
			
		||||
    export MANAGE_REPOS="false"
 | 
			
		||||
    ./run_tests.sh
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										68
									
								
								run_tests.sh
									
									
									
									
									
								
							
							
						
						
									
										68
									
								
								run_tests.sh
									
									
									
									
									
								
							@@ -1,2 +1,66 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
tox -epy26,py27,pep8
 | 
			
		||||
#!/bin/bash -ex
 | 
			
		||||
# Copyright 2015 Red Hat, 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.
 | 
			
		||||
 | 
			
		||||
SCENARIO=${SCENARIO:-scenario001}
 | 
			
		||||
 | 
			
		||||
# We could want to override the default repositories
 | 
			
		||||
MANAGE_REPOS=${MANAGE_REPOS:-true}
 | 
			
		||||
DELOREAN=${DELOREAN:-http://trunk.rdoproject.org/centos7/current/delorean.repo}
 | 
			
		||||
DELOREAN_DEPS=${DELOREAN_DEPS:-http://trunk.rdoproject.org/centos7/delorean-deps.repo}
 | 
			
		||||
 | 
			
		||||
if [ $(id -u) != 0 ]; then
 | 
			
		||||
    # preserve environment so we can have ZUUL_* params
 | 
			
		||||
    SUDO='sudo -E'
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Setup repositories
 | 
			
		||||
if [ "${MANAGE_REPOS}" = true ]; then
 | 
			
		||||
    $SUDO curl ${DELOREAN} -o /etc/yum.repos.d/delorean.repo
 | 
			
		||||
    $SUDO curl ${DELOREAN_DEPS} -o /etc/yum.repos.d/delorean-deps.repo
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Install dependencies
 | 
			
		||||
$SUDO yum -y install yum-plugin-priorities \
 | 
			
		||||
                     dstat \
 | 
			
		||||
                     python-setuptools \
 | 
			
		||||
                     openssl-devel \
 | 
			
		||||
                     python-devel \
 | 
			
		||||
                     libffi-devel \
 | 
			
		||||
                     libxml2-devel \
 | 
			
		||||
                     libxslt-devel \
 | 
			
		||||
                     ruby-devel \
 | 
			
		||||
                     openstack-selinux \
 | 
			
		||||
                     "@Development Tools"
 | 
			
		||||
 | 
			
		||||
# Setup dstat for resource usage tracing
 | 
			
		||||
if type "dstat" 2>/dev/null; then
 | 
			
		||||
  $SUDO dstat -tcmndrylpg \
 | 
			
		||||
              --top-cpu-adv \
 | 
			
		||||
              --top-io-adv \
 | 
			
		||||
              --nocolor | $SUDO tee --append /var/log/dstat.log > /dev/null &
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Setup packstack
 | 
			
		||||
$SUDO python setup.py install
 | 
			
		||||
$SUDO python setup.py install_puppet_modules
 | 
			
		||||
 | 
			
		||||
# Generate configuration from selected scenario and run it
 | 
			
		||||
./tests/${SCENARIO}.sh
 | 
			
		||||
result=$?
 | 
			
		||||
 | 
			
		||||
# Generate subunit
 | 
			
		||||
/var/lib/tempest/.venv/bin/testr last --subunit > /var/tmp/packstack/latest/testrepository.subunit
 | 
			
		||||
 | 
			
		||||
exit $result
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								tests/scenario001.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										35
									
								
								tests/scenario001.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
#!/bin/bash -ex
 | 
			
		||||
PACKSTACK_CONFIG_FILE="/tmp/packstack.txt"
 | 
			
		||||
 | 
			
		||||
if [ $(id -u) != 0 ]; then
 | 
			
		||||
    # preserve environment so we can have ZUUL_* params
 | 
			
		||||
    SUDO='sudo -E'
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo -e "Generating packstack config for:
 | 
			
		||||
- keystone
 | 
			
		||||
- glance (file backend)
 | 
			
		||||
- nova
 | 
			
		||||
- neutron (ovs+vxlan)
 | 
			
		||||
- cinder (lvm+iscsi)
 | 
			
		||||
- ceilometer
 | 
			
		||||
- aodh
 | 
			
		||||
- trove
 | 
			
		||||
- manila
 | 
			
		||||
- nagios"
 | 
			
		||||
echo "tempest will run if packstack's installation completes successfully."
 | 
			
		||||
echo
 | 
			
		||||
 | 
			
		||||
packstack --allinone \
 | 
			
		||||
          --os-swift-install=n \
 | 
			
		||||
          --os-horizon-install=n \
 | 
			
		||||
          --os-manila-install=y \
 | 
			
		||||
          --glance-backend=swift \
 | 
			
		||||
          --provision-demo=y \
 | 
			
		||||
          --provision-tempest=y \
 | 
			
		||||
          --run-tempest=y \
 | 
			
		||||
          --run-tempest-tests="smoke TelemetryAlarming" \
 | 
			
		||||
          --gen-answer-file=${PACKSTACK_CONFIG_FILE}
 | 
			
		||||
sed -i -re "s,(.*_PASSWORD|.*_PW)=.*,\1=packstack," ${PACKSTACK_CONFIG_FILE}
 | 
			
		||||
 | 
			
		||||
$SUDO packstack --answer-file=${PACKSTACK_CONFIG_FILE}
 | 
			
		||||
							
								
								
									
										39
									
								
								tests/scenario002.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										39
									
								
								tests/scenario002.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
#!/bin/bash -ex
 | 
			
		||||
PACKSTACK_CONFIG_FILE="/tmp/packstack.txt"
 | 
			
		||||
 | 
			
		||||
if [ $(id -u) != 0 ]; then
 | 
			
		||||
    # preserve environment so we can have ZUUL_* params
 | 
			
		||||
    SUDO='sudo -E'
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo -e "Generating packstack config for:
 | 
			
		||||
- keystone
 | 
			
		||||
- glance (swift backend)
 | 
			
		||||
- nova
 | 
			
		||||
- neutron (ovs+vxlan)
 | 
			
		||||
- heat
 | 
			
		||||
- swift
 | 
			
		||||
- sahara
 | 
			
		||||
- horizon
 | 
			
		||||
- trove
 | 
			
		||||
- tempest (regex: 'smoke dashboard')"
 | 
			
		||||
echo "tempest will run if packstack's installation completes successfully."
 | 
			
		||||
echo
 | 
			
		||||
 | 
			
		||||
packstack --allinone \
 | 
			
		||||
          --os-aodh-install=n \
 | 
			
		||||
          --os-ceilometer-install=n \
 | 
			
		||||
          --os-cinder-install=n \
 | 
			
		||||
          --nagios-install=n \
 | 
			
		||||
          --glance-backend=swift \
 | 
			
		||||
          --os-sahara-install=y \
 | 
			
		||||
          --os-heat-install=y \
 | 
			
		||||
          --os-trove-install=y \
 | 
			
		||||
          --provision-demo=y \
 | 
			
		||||
          --provision-tempest=y \
 | 
			
		||||
          --run-tempest=y \
 | 
			
		||||
          --run-tempest-tests="smoke dashboard" \
 | 
			
		||||
          --gen-answer-file=${PACKSTACK_CONFIG_FILE}
 | 
			
		||||
sed -i -re "s,(.*_PASSWORD|.*_PW)=.*,\1=packstack," ${PACKSTACK_CONFIG_FILE}
 | 
			
		||||
 | 
			
		||||
$SUDO packstack --answer-file=${PACKSTACK_CONFIG_FILE}
 | 
			
		||||
		Reference in New Issue
	
	Block a user