Use tox to satisfy functional test requirements

Instead of installing and polluting the host development system
with the required packages to run the functional tests, it is
now possible to run the functional tests from inside tox.  All
the required packages are installed in the tox environment and
run from there.

The only external dependencies are that the functional tests
still must use /etc/swift for configuration files on the host
and /mnt/gluster-object must be on a XFS or GlusterFS volume.

Change-Id: I4a949dbcad778018e22c61d09ae1ba5f21a03aec
Signed-off-by: Luis Pabon <lpabon@redhat.com>
Reviewed-on: http://review.gluster.org/5976
Reviewed-by: Peter Portante <pportant@redhat.com>
Tested-by: Peter Portante <pportant@redhat.com>
This commit is contained in:
Luis Pabon 2013-09-19 13:18:17 -04:00 committed by Peter Portante
parent 7d5e6ed57e
commit b8bc402508
5 changed files with 45 additions and 36 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ test/unit/nosetests.xml
test/unit/coverage.xml
test/unit/cover
build
*.pyc

View File

@ -12,12 +12,20 @@ changes to Gerrit. Follow the the information given
at [GitHub Generating SSH Keys][] if you need help creating your key.
### Package Requirements
Type the following to install the required packages:
#### Fedora 19
On Fedora 19 systems, type:
* Ubuntu
~~~
sudo yum install gcc python-devel python-setuptools libffi-devel git rpm-build
sudo apt-get -y install gcc python-dev python-setuptools libffi-dev \
git xfsprogs memcached
~~~
* Fedora 19
~~~
sudo yum install gcc python-devel python-setuptools libffi-devel \
git rpm-build xfsprogs memcached
~~~
### Git Setup
@ -51,7 +59,7 @@ It is recommended to use this tool to upload, modify, and query changes in Gerri
The tool can be installed by running the following command:
~~~
sudo pip install git-review
sudo pip install --upgrade git-review
~~~
While many Linux distributions offer a version of `git review`,
@ -93,7 +101,7 @@ Like OpenStack Swift, Gluster for Swift uses `tox` python virtual
environment for its unit tests. To install `tox` type:
~~~
pip install tox nose
sudo pip install --upgrade tox nose
~~~
## Workflow
@ -136,28 +144,19 @@ tests are available under the `test/unit` directory.
#### Functional Tests
##### OpenStack Swift Havana Setup
Currently, Havana OpenStack Swift is still under development. While
currently there is no official release for Havana Swift, there is a
yum repo with multiple Havana Swift RPM development releases available.
Please refer to the following [README][] file for more information.
##### Executing the tests
The automated functional tests only run on RPM based systems
like Fedora/CentOS, etc. To run the functional tests, the following
requirements must be met.
To run the functional tests, the following requirements must be met.
1. `/etc/swift` must not exist.
1. User needs to have `sudo` access; no password necessary
1. User needs to have `sudo` access
1. `/mnt/gluster-object/test` and `/mnt/gluster-object/test2` directories
must be created on either an XFS or GlusterFS volume.
1. glusterfs-openstack-swift RPM must not be installed on the system
Once the requirements have been met, you can now run the full functional
tests using the following command:
~~~
tools/functional_tests.sh
tox -e functest
~~~
### Commiting changes

View File

@ -33,15 +33,21 @@ setup(
packages=find_packages(exclude=['test', 'bin']),
test_suite='nose.collector',
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.6',
'Environment :: No Input/Output (Daemon)',
'Development Status :: 5 - Production/Stable'
'Environment :: OpenStack'
'Intended Audience :: Information Technology'
'Intended Audience :: System Administrators'
'License :: OSI Approved :: Apache Software License'
'Operating System :: POSIX :: Linux'
'Programming Language :: Python'
'Programming Language :: Python :: 2'
'Programming Language :: Python :: 2.6'
'Programming Language :: Python :: 2.7'
],
install_requires=[], # removed for better compat
install_requires=[],
scripts=[
'bin/gluster-swift-gen-builders',
'bin/gluster-swift-print-metadata',
],
entry_points={
'paste.app_factory': [

View File

@ -15,13 +15,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Globals
# This program expects to be run by tox in a virtual python environment
# so that it does not pollute the host development system
sudo_env()
{
sudo bash -c "PATH=$PATH $*"
}
cleanup()
{
sudo service memcached stop
sudo swift-init main stop
sudo pip uninstall -y gluster-swift
sudo_env swift-init main stop
sudo rm -rf /etc/swift > /dev/null 2>&1
sudo rm -rf /mnt/gluster-object/test{,2}/* > /dev/null 2>&1
sudo setfattr -x user.swift.metadata /mnt/gluster-object/test{,2} > /dev/null 2>&1
@ -57,21 +62,14 @@ done
export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf
# Download and cache swift
pip install --no-install --download-cache=$HOME/.pipcache swift==1.9.1
# Install swift
sudo pip install --download-cache=$HOME/.pipcache swift==1.9.1
# Install gluster-swift
sudo pip install -e $PWD
# Install the configuration files
sudo mkdir /etc/swift > /dev/null 2>&1
sudo cp -r test/functional/conf/* /etc/swift || fail "Unable to copy configuration files to /etc/swift"
( cd /etc/swift ; sudo gluster-swift-gen-builders test test2 ) || fail "Unable to create ring files"
sudo_env gluster-swift-gen-builders test test2 || fail "Unable to create ring files"
# Start the services
sudo service memcached start || fail "Unable to start memcached"
sudo swift-init main start || fail "Unable to start swift"
sudo_env swift-init main start || fail "Unable to start swift"
mkdir functional_tests > /dev/null 2>&1
nosetests -v --exe \

View File

@ -1,5 +1,5 @@
[tox]
envlist = py26,py27,pep8
envlist = py26,py27,pep8,functest
[testenv]
setenv = VIRTUAL_ENV={envdir}
@ -18,6 +18,11 @@ commands = nosetests -v --exe --with-xunit --with-coverage --cover-package glust
[tox:jenkins]
downloadcache = ~/cache/pip
[testenv:functest]
changedir = {toxinidir}
whitelist_externals=bash
commands = bash tools/functional_tests.sh
[testenv:pep8]
changedir = {toxinidir}
commands =