Made older functional tests look for default config file when env variable is unset
This commit is contained in:
parent
2962557612
commit
e5c5a3778e
@ -24,6 +24,7 @@ import urllib
|
|||||||
|
|
||||||
import simplejson as json
|
import simplejson as json
|
||||||
|
|
||||||
|
from nose import SkipTest
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
|
|
||||||
class AuthenticationFailed(Exception):
|
class AuthenticationFailed(Exception):
|
||||||
@ -79,6 +80,10 @@ def listing_items(method):
|
|||||||
|
|
||||||
class Connection(object):
|
class Connection(object):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
|
for key in 'auth_host auth_port auth_ssl account username password'.split():
|
||||||
|
if not config.has_key(key):
|
||||||
|
raise SkipTest
|
||||||
|
|
||||||
self.auth_host = config['auth_host']
|
self.auth_host = config['auth_host']
|
||||||
self.auth_port = int(config['auth_port'])
|
self.auth_port = int(config['auth_port'])
|
||||||
self.auth_ssl = config['auth_ssl'] in ('on', 'true', 'yes', '1')
|
self.auth_ssl = config['auth_ssl'] in ('on', 'true', 'yes', '1')
|
||||||
|
@ -19,8 +19,10 @@ import configobj
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
|
import os.path
|
||||||
import random
|
import random
|
||||||
import StringIO
|
import StringIO
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
import uuid
|
import uuid
|
||||||
@ -30,10 +32,18 @@ import urllib
|
|||||||
from swift import Account, AuthenticationFailed, Connection, Container, \
|
from swift import Account, AuthenticationFailed, Connection, Container, \
|
||||||
File, ResponseError
|
File, ResponseError
|
||||||
|
|
||||||
config = configobj.ConfigObj(os.environ['SWIFT_TEST_CONFIG_FILE'])
|
config_file_env_var = 'SWIFT_TEST_CONFIG_FILE'
|
||||||
locale.setlocale(locale.LC_COLLATE, config.get('collate', 'C'))
|
default_config_file = '/etc/swift/func_test.conf'
|
||||||
|
|
||||||
NoRun = object
|
if os.environ.has_key(config_file_env_var):
|
||||||
|
config_file = os.environ[config_file_env_var]
|
||||||
|
elif os.path.isfile(default_config_file):
|
||||||
|
config_file = default_config_file
|
||||||
|
else:
|
||||||
|
print >>sys.stderr, 'SKIPPING FUNCTIONAL TESTS DUE TO NO CONFIG'
|
||||||
|
|
||||||
|
config = configobj.ConfigObj(config_file)
|
||||||
|
locale.setlocale(locale.LC_COLLATE, config.get('collate', 'C'))
|
||||||
|
|
||||||
class Base:
|
class Base:
|
||||||
pass
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user