Merge "make test tooling less opinionated"

This commit is contained in:
Jenkins 2013-12-07 04:21:53 +00:00 committed by Gerrit Code Review
commit 1e5760e3e1
4 changed files with 16 additions and 8 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SRC_DIR=$(dirname $0) SRC_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")
cd ${SRC_DIR}/test/functional cd ${SRC_DIR}/test/functional
nosetests --exe $@ nosetests --exe $@

View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
cd $(dirname $0)/test/probe SRC_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")
cd ${SRC_DIR}/test/probe
nosetests --exe nosetests --exe
rvalue=$? rvalue=$?
cd - cd -

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
TOP_DIR=$(dirname $(python -c 'import os,sys;print os.path.realpath(sys.argv[1])' $0)) TOP_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")
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)' 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)'
if [ $? != 0 ]; then if [ $? != 0 ]; then

View File

@ -24,7 +24,8 @@ from time import sleep, time
from swiftclient import get_auth, head_account from swiftclient import get_auth, head_account
from swift.common.ring import Ring from swift.common.ring import Ring
from swift.common.utils import readconf, ismount from swift.common.utils import readconf
from swift.common.manager import Manager
from test.probe import CHECK_SERVER_TIMEOUT, VALIDATE_RSYNC from test.probe import CHECK_SERVER_TIMEOUT, VALIDATE_RSYNC
@ -153,9 +154,10 @@ def get_ring(server, force_validate=None):
conf = port_to_config[dev['port']] conf = port_to_config[dev['port']]
for device in os.listdir(conf['devices']): for device in os.listdir(conf['devices']):
if device == dev['device']: if device == dev['device']:
full_path = path.realpath(path.join(conf['devices'], device)) dev_path = path.join(conf['devices'], device)
assert ismount(full_path), \ full_path = path.realpath(dev_path)
'device %s in %s was not mounted (%s)' % ( assert path.exists(full_path), \
'device %s in %s was not found (%s)' % (
device, conf['devices'], full_path) device, conf['devices'], full_path)
break break
else: else:
@ -163,7 +165,10 @@ def get_ring(server, force_validate=None):
"unable to find ring device %s under %s's devices (%s)" % ( "unable to find ring device %s under %s's devices (%s)" % (
dev['device'], server, conf['devices'])) dev['device'], server, conf['devices']))
# verify server is exposing rsync device # verify server is exposing rsync device
rsync_export = '%s%s' % (server, dev['replication_port']) if port_to_config[dev['port']].get('vm_test_mode', False):
rsync_export = '%s%s' % (server, dev['replication_port'])
else:
rsync_export = server
cmd = "rsync rsync://localhost/%s" % rsync_export cmd = "rsync rsync://localhost/%s" % rsync_export
p = Popen(cmd, shell=True, stdout=PIPE) p = Popen(cmd, shell=True, stdout=PIPE)
stdout, _stderr = p.communicate() stdout, _stderr = p.communicate()
@ -184,6 +189,7 @@ def reset_environment():
p = Popen("resetswift 2>&1", shell=True, stdout=PIPE) p = Popen("resetswift 2>&1", shell=True, stdout=PIPE)
stdout, _stderr = p.communicate() stdout, _stderr = p.communicate()
print stdout print stdout
Manager(['all']).stop()
pids = {} pids = {}
try: try:
account_ring = get_ring('account') account_ring = get_ring('account')