Modify unit tests and func tests
* Updated tox.ini * Created .unittests and .functests * Added tempurl to pipeline in conf files so that tempurl tests are not skipped * Updated .gitignore file Signed-off-by: Prashanth Pai <ppai@redhat.com>
This commit is contained in:
parent
d23fd1b56c
commit
cb7e968873
88
.functests
Executable file
88
.functests
Executable file
@ -0,0 +1,88 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (c) 2013 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.
|
||||||
|
|
||||||
|
# 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_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
|
||||||
|
}
|
||||||
|
|
||||||
|
quit()
|
||||||
|
{
|
||||||
|
echo "$1"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fail()
|
||||||
|
{
|
||||||
|
cleanup
|
||||||
|
quit "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
### MAIN ###
|
||||||
|
# This script runs functional tests only with tempauth
|
||||||
|
|
||||||
|
if [ $EUID -ne 0 ]; then
|
||||||
|
echo "Functional tests must be run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only run if there is no configuration in the system
|
||||||
|
if [ -x /etc/swift ] ; then
|
||||||
|
quit "/etc/swift exists, cannot run functional tests."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check the directories exist
|
||||||
|
DIRS="/mnt/gluster-object /mnt/gluster-object/test /mnt/gluster-object/test2"
|
||||||
|
for d in $DIRS ; do
|
||||||
|
if [ ! -x $d ] ; then
|
||||||
|
quit "$d must exist on an XFS or GlusterFS volume"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf
|
||||||
|
|
||||||
|
# Install the configuration files
|
||||||
|
sudo mkdir /etc/swift > /dev/null 2>&1
|
||||||
|
sudo cp -r test/functional_auth/tempauth/conf/* /etc/swift || fail "Unable to copy configuration files to /etc/swift"
|
||||||
|
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_env swift-init main start || fail "Unable to start swift"
|
||||||
|
|
||||||
|
mkdir functional_tests_result > /dev/null 2>&1
|
||||||
|
nosetests -v --exe \
|
||||||
|
--with-xunit \
|
||||||
|
--xunit-file functional_tests_result/gluster-swift-generic-functional-TC-report.xml \
|
||||||
|
--with-html-output \
|
||||||
|
--html-out-file functional_tests_result/gluster-swift-generic-functional-result.html \
|
||||||
|
test/functional || fail "Functional tests failed"
|
||||||
|
cleanup
|
||||||
|
exit 0
|
22
.gitignore
vendored
22
.gitignore
vendored
@ -1,9 +1,13 @@
|
|||||||
/.tox
|
*.py[co]
|
||||||
gluster_swift.egg-info
|
*.sw?
|
||||||
/test/unit/.coverage
|
*~
|
||||||
/test/unit/nosetests.xml
|
dist
|
||||||
/test/unit/coverage.xml
|
build
|
||||||
/test/unit/cover
|
cover
|
||||||
/build
|
functional_tests_result
|
||||||
/swift
|
.coverage
|
||||||
*.pyc
|
*.egg
|
||||||
|
*.egg-info
|
||||||
|
.tox
|
||||||
|
pycscope.*
|
||||||
|
cscope.*
|
||||||
|
@ -15,10 +15,19 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
|
TOP_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")
|
||||||
|
|
||||||
cd $(dirname $0)/test/unit
|
python -c 'from distutils.version import LooseVersion as Ver; import nose, sys; sys.exit(0 if Ver(nose.__version__) >= Ver("1.2.0") else 1)'
|
||||||
nosetests -v --exe --with-coverage --cover-package gluster --cover-erase --cover-html --cover-branches $@
|
if [ $? != 0 ]; then
|
||||||
|
cover_branches=""
|
||||||
saved_status=$?
|
else
|
||||||
|
# Having the HTML reports is REALLY useful for achieving 100% branch
|
||||||
|
# coverage.
|
||||||
|
cover_branches="--cover-branches --cover-html --cover-html-dir=$TOP_DIR/cover"
|
||||||
|
fi
|
||||||
|
cd $TOP_DIR/test/unit
|
||||||
|
nosetests -v --exe --with-coverage --cover-package gluster. --cover-erase $cover_branches $@
|
||||||
|
rvalue=$?
|
||||||
rm -f .coverage
|
rm -f .coverage
|
||||||
exit $saved_status
|
cd -
|
||||||
|
exit $rvalue
|
@ -5,7 +5,7 @@ user = root
|
|||||||
workers = 1
|
workers = 1
|
||||||
|
|
||||||
[pipeline:main]
|
[pipeline:main]
|
||||||
pipeline = catch_errors healthcheck proxy-logging cache gswauth proxy-logging proxy-server
|
pipeline = catch_errors healthcheck proxy-logging cache tempurl gswauth proxy-logging proxy-server
|
||||||
|
|
||||||
[app:proxy-server]
|
[app:proxy-server]
|
||||||
use = egg:gluster_swift#proxy
|
use = egg:gluster_swift#proxy
|
||||||
@ -76,3 +76,6 @@ use = egg:swift#memcache
|
|||||||
# Update this line to contain a comma separated list of memcache servers
|
# Update this line to contain a comma separated list of memcache servers
|
||||||
# shared by all nodes running the proxy-server service.
|
# shared by all nodes running the proxy-server service.
|
||||||
memcache_servers = localhost:11211
|
memcache_servers = localhost:11211
|
||||||
|
|
||||||
|
[filter:tempurl]
|
||||||
|
use = egg:swift#tempurl
|
||||||
|
@ -6,7 +6,7 @@ workers = 1
|
|||||||
|
|
||||||
[pipeline:main]
|
[pipeline:main]
|
||||||
#pipeline = catch_errors healthcheck proxy-logging cache tempauth proxy-logging proxy-server
|
#pipeline = catch_errors healthcheck proxy-logging cache tempauth proxy-logging proxy-server
|
||||||
pipeline = catch_errors healthcheck proxy-logging cache authtoken keystoneauth proxy-logging proxy-server
|
pipeline = catch_errors healthcheck proxy-logging cache tempurl authtoken keystoneauth proxy-logging proxy-server
|
||||||
|
|
||||||
[app:proxy-server]
|
[app:proxy-server]
|
||||||
use = egg:gluster_swift#proxy
|
use = egg:gluster_swift#proxy
|
||||||
@ -92,3 +92,6 @@ use = egg:swift#memcache
|
|||||||
# Update this line to contain a comma separated list of memcache servers
|
# Update this line to contain a comma separated list of memcache servers
|
||||||
# shared by all nodes running the proxy-server service.
|
# shared by all nodes running the proxy-server service.
|
||||||
memcache_servers = localhost:11211
|
memcache_servers = localhost:11211
|
||||||
|
|
||||||
|
[filter:tempurl]
|
||||||
|
use = egg:swift#tempurl
|
||||||
|
@ -5,7 +5,7 @@ user = root
|
|||||||
workers = 1
|
workers = 1
|
||||||
|
|
||||||
[pipeline:main]
|
[pipeline:main]
|
||||||
pipeline = catch_errors healthcheck proxy-logging cache proxy-logging kerbauth proxy-server
|
pipeline = catch_errors healthcheck proxy-logging cache tempurl proxy-logging kerbauth proxy-server
|
||||||
|
|
||||||
[app:proxy-server]
|
[app:proxy-server]
|
||||||
use = egg:gluster_swift#proxy
|
use = egg:gluster_swift#proxy
|
||||||
@ -68,3 +68,6 @@ use = egg:swift#memcache
|
|||||||
# Update this line to contain a comma separated list of memcache servers
|
# Update this line to contain a comma separated list of memcache servers
|
||||||
# shared by all nodes running the proxy-server service.
|
# shared by all nodes running the proxy-server service.
|
||||||
memcache_servers = localhost:11211
|
memcache_servers = localhost:11211
|
||||||
|
|
||||||
|
[filter:tempurl]
|
||||||
|
use = egg:swift#tempurl
|
||||||
|
@ -5,7 +5,7 @@ user = root
|
|||||||
workers = 1
|
workers = 1
|
||||||
|
|
||||||
[pipeline:main]
|
[pipeline:main]
|
||||||
pipeline = catch_errors healthcheck proxy-logging cache tempauth proxy-logging proxy-server
|
pipeline = catch_errors healthcheck proxy-logging cache tempurl tempauth proxy-logging proxy-server
|
||||||
|
|
||||||
[app:proxy-server]
|
[app:proxy-server]
|
||||||
use = egg:gluster_swift#proxy
|
use = egg:gluster_swift#proxy
|
||||||
@ -70,3 +70,6 @@ use = egg:swift#memcache
|
|||||||
# Update this line to contain a comma separated list of memcache servers
|
# Update this line to contain a comma separated list of memcache servers
|
||||||
# shared by all nodes running the proxy-server service.
|
# shared by all nodes running the proxy-server service.
|
||||||
memcache_servers = localhost:11211
|
memcache_servers = localhost:11211
|
||||||
|
|
||||||
|
[filter:tempurl]
|
||||||
|
use = egg:swift#tempurl
|
||||||
|
@ -50,7 +50,7 @@ quit()
|
|||||||
fail()
|
fail()
|
||||||
{
|
{
|
||||||
cleanup
|
cleanup
|
||||||
quit "$1"
|
quit "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_generic_tests()
|
run_generic_tests()
|
||||||
@ -66,9 +66,9 @@ run_generic_tests()
|
|||||||
|
|
||||||
nosetests -v --exe \
|
nosetests -v --exe \
|
||||||
--with-xunit \
|
--with-xunit \
|
||||||
--xunit-file functional_tests/gluster-swift-gswauth-generic-functional-TC-report.xml \
|
--xunit-file functional_tests_result/gluster-swift-gswauth-generic-functional-TC-report.xml \
|
||||||
--with-html-output \
|
--with-html-output \
|
||||||
--html-out-file functional_tests/gluster-swift-gswauth-generic-functional-result.html \
|
--html-out-file functional_tests_result/gluster-swift-gswauth-generic-functional-result.html \
|
||||||
test/functional || fail "Functional tests failed"
|
test/functional || fail "Functional tests failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,12 +101,12 @@ sudo_env swift-init main start || fail "Unable to start swift"
|
|||||||
#swauth-prep
|
#swauth-prep
|
||||||
sudo_env gswauth-prep -K gswauthkey || fail "Unable to prep gswauth"
|
sudo_env gswauth-prep -K gswauthkey || fail "Unable to prep gswauth"
|
||||||
|
|
||||||
mkdir functional_tests > /dev/null 2>&1
|
mkdir functional_tests_result > /dev/null 2>&1
|
||||||
nosetests -v --exe \
|
nosetests -v --exe \
|
||||||
--with-xunit \
|
--with-xunit \
|
||||||
--xunit-file functional_tests/gluster-swift-gswauth-functional-TC-report.xml \
|
--xunit-file functional_tests_result/gluster-swift-gswauth-functional-TC-report.xml \
|
||||||
--with-html-output \
|
--with-html-output \
|
||||||
--html-out-file functional_tests/gluster-swift-gswauth-functional-result.html \
|
--html-out-file functional_tests_result/gluster-swift-gswauth-functional-result.html \
|
||||||
test/functional_auth/gswauth || fail "Functional gswauth test failed"
|
test/functional_auth/gswauth || fail "Functional gswauth test failed"
|
||||||
|
|
||||||
run_generic_tests
|
run_generic_tests
|
||||||
|
@ -87,15 +87,15 @@ sudo_env gluster-swift-gen-builders $accounts || fail "Unable to create ring fil
|
|||||||
sudo service memcached start || fail "Unable to start memcached"
|
sudo service memcached start || fail "Unable to start memcached"
|
||||||
sudo_env 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
|
mkdir functional_tests_result > /dev/null 2>&1
|
||||||
|
|
||||||
echo "== Keystone: Generic Functional Tests =="
|
echo "== Keystone: Generic Functional Tests =="
|
||||||
|
|
||||||
nosetests -v --exe \
|
nosetests -v --exe \
|
||||||
--with-xunit \
|
--with-xunit \
|
||||||
--xunit-file functional_tests/gluster-swift-keystone-generic-functional-TC-report.xml \
|
--xunit-file functional_tests_result/gluster-swift-keystone-generic-functional-TC-report.xml \
|
||||||
--with-html-output \
|
--with-html-output \
|
||||||
--html-out-file functional_tests/gluster-swift-keystone-generic-functional-result.html \
|
--html-out-file functional_tests_result/gluster-swift-keystone-generic-functional-result.html \
|
||||||
test/functional || fail "Functional tests failed"
|
test/functional || fail "Functional tests failed"
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
@ -80,16 +80,16 @@ sudo_env gluster-swift-gen-builders $accounts || fail "Unable to create ring fil
|
|||||||
sudo service memcached start || fail "Unable to start memcached"
|
sudo service memcached start || fail "Unable to start memcached"
|
||||||
sudo_env 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
|
mkdir functional_tests_result > /dev/null 2>&1
|
||||||
|
|
||||||
echo "== SwiftKerbAuth: Functional Tests =="
|
echo "== SwiftKerbAuth: Functional Tests =="
|
||||||
|
|
||||||
|
|
||||||
nosetests -v --exe \
|
nosetests -v --exe \
|
||||||
--with-xunit \
|
--with-xunit \
|
||||||
--xunit-file functional_tests/gluster-swift-swiftkerbauth-generic-functional-TC-report.xml \
|
--xunit-file functional_tests_result/gluster-swift-swiftkerbauth-generic-functional-TC-report.xml \
|
||||||
--with-html-output \
|
--with-html-output \
|
||||||
--html-out-file functional_tests/gluster-swift-swiftkerbauth-generic-functional-result.html \
|
--html-out-file functional_tests_result/gluster-swift-swiftkerbauth-generic-functional-result.html \
|
||||||
test/functional_auth/swiftkerbauth || fail "Functional tests failed"
|
test/functional_auth/swiftkerbauth || fail "Functional tests failed"
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
26
tox.ini
26
tox.ini
@ -14,20 +14,29 @@ setenv = VIRTUAL_ENV={envdir}
|
|||||||
NOSE_OPENSTACK_YELLOW=0.025
|
NOSE_OPENSTACK_YELLOW=0.025
|
||||||
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
NOSE_OPENSTACK_SHOW_ELAPSED=1
|
||||||
NOSE_OPENSTACK_STDOUT=1
|
NOSE_OPENSTACK_STDOUT=1
|
||||||
|
NOSE_WITH_COVERAGE=1
|
||||||
|
NOSE_COVER_BRANCHES=1
|
||||||
|
NOSE_COVER_PACKAGE=gluster
|
||||||
deps =
|
deps =
|
||||||
https://launchpad.net/swift/icehouse/1.13.1/+download/swift-1.13.1.tar.gz
|
https://launchpad.net/swift/icehouse/1.13.1/+download/swift-1.13.1.tar.gz
|
||||||
--download-cache={homedir}/.pipcache
|
|
||||||
-r{toxinidir}/requirements.txt
|
-r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
changedir = {toxinidir}/test/unit
|
changedir = {toxinidir}/test/unit
|
||||||
commands = nosetests -v --exe --with-xunit --with-coverage --cover-package gluster --cover-erase --cover-xml --cover-html --cover-branches --with-html-output {posargs}
|
commands = nosetests -v {posargs}
|
||||||
|
|
||||||
|
[testenv:cover]
|
||||||
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
|
NOSE_WITH_COVERAGE=1
|
||||||
|
NOSE_COVER_BRANCHES=1
|
||||||
|
NOSE_COVER_HTML=1
|
||||||
|
NOSE_COVER_HTML_DIR={toxinidir}/cover
|
||||||
|
|
||||||
[tox:jenkins]
|
[tox:jenkins]
|
||||||
downloadcache = ~/cache/pip
|
downloadcache = ~/cache/pip
|
||||||
|
|
||||||
[testenv:functest]
|
[testenv:functest]
|
||||||
changedir = {toxinidir}
|
changedir = {toxinidir}
|
||||||
commands = bash tools/functional_tests.sh
|
commands = bash ./.functests
|
||||||
bash tools/gswauth_functional_tests.sh
|
bash tools/gswauth_functional_tests.sh
|
||||||
|
|
||||||
[testenv:ksfunctest]
|
[testenv:ksfunctest]
|
||||||
@ -39,20 +48,13 @@ changedir = {toxinidir}
|
|||||||
commands = bash tools/swkrbath_functional_tests.sh
|
commands = bash tools/swkrbath_functional_tests.sh
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
deps =
|
|
||||||
--download-cache={homedir}/.pipcache
|
|
||||||
-r{toxinidir}/test-requirements.txt
|
|
||||||
changedir = {toxinidir}
|
changedir = {toxinidir}
|
||||||
commands =
|
commands =
|
||||||
flake8
|
flake8 gluster test setup.py
|
||||||
flake8 gluster test
|
|
||||||
|
|
||||||
[testenv:cover]
|
|
||||||
setenv = NOSE_WITH_COVERAGE=1
|
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands =
|
|
||||||
changedir = {toxinidir}
|
changedir = {toxinidir}
|
||||||
|
commands = {posargs}
|
||||||
|
|
||||||
[testenv:run]
|
[testenv:run]
|
||||||
changedir = {toxinidir}
|
changedir = {toxinidir}
|
||||||
|
Loading…
Reference in New Issue
Block a user