synced /next
This commit is contained in:
commit
28e81927ac
|
@ -1,2 +1,5 @@
|
||||||
.coverage
|
|
||||||
bin
|
bin
|
||||||
|
.coverage
|
||||||
|
.testrepository
|
||||||
|
.tox
|
||||||
|
tags
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
[DEFAULT]
|
||||||
|
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||||
|
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||||
|
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||||
|
${PYTHON:-python} -m subunit.run discover -t ./ ./unit_tests $LISTOPT $IDOPTION
|
||||||
|
|
||||||
|
test_id_option=--load-list $IDFILE
|
||||||
|
test_list_option=--list
|
|
@ -152,6 +152,9 @@ def config_changed():
|
||||||
for r_id in relation_ids('identity-service'):
|
for r_id in relation_ids('identity-service'):
|
||||||
keystone_joined(relid=r_id)
|
keystone_joined(relid=r_id)
|
||||||
|
|
||||||
|
for r_id in relation_ids('object-store'):
|
||||||
|
object_store_joined(relation_id=r_id)
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('identity-service-relation-joined')
|
@hooks.hook('identity-service-relation-joined')
|
||||||
def keystone_joined(relid=None):
|
def keystone_joined(relid=None):
|
||||||
|
@ -257,6 +260,16 @@ def storage_broken():
|
||||||
CONFIGS.write_all()
|
CONFIGS.write_all()
|
||||||
|
|
||||||
|
|
||||||
|
@hooks.hook('object-store-relation-joined')
|
||||||
|
def object_store_joined(relation_id=None):
|
||||||
|
relation_data = {
|
||||||
|
'swift-url':
|
||||||
|
"{}:{}".format(canonical_url(CONFIGS, INTERNAL), config('bind-port'))
|
||||||
|
}
|
||||||
|
|
||||||
|
relation_set(relation_id=relation_id, **relation_data)
|
||||||
|
|
||||||
|
|
||||||
@hooks.hook('cluster-relation-joined')
|
@hooks.hook('cluster-relation-joined')
|
||||||
def cluster_joined(relation_id=None):
|
def cluster_joined(relation_id=None):
|
||||||
for addr_type in ADDRESS_TYPES:
|
for addr_type in ADDRESS_TYPES:
|
||||||
|
|
|
@ -129,8 +129,8 @@ class SwiftIdentityContext(OSContextGenerator):
|
||||||
auth_host = config('keystone-auth-host')
|
auth_host = config('keystone-auth-host')
|
||||||
admin_user = config('keystone-admin-user')
|
admin_user = config('keystone-admin-user')
|
||||||
admin_password = config('keystone-admin-user')
|
admin_password = config('keystone-admin-user')
|
||||||
if (auth_type == 'keystone' and auth_host
|
if (auth_type == 'keystone' and auth_host and
|
||||||
and admin_user and admin_password):
|
admin_user and admin_password):
|
||||||
log('Using user-specified Keystone configuration.')
|
log('Using user-specified Keystone configuration.')
|
||||||
ks_auth = {
|
ks_auth = {
|
||||||
'auth_type': 'keystone',
|
'auth_type': 'keystone',
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
PyYAML>=3.1.0
|
||||||
|
simplejson>=2.2.0
|
||||||
|
netifaces>=0.10.4
|
||||||
|
netaddr>=0.7.12,!=0.7.16
|
||||||
|
Jinja2>=2.6 # BSD License (3 clause)
|
||||||
|
six>=1.9.0
|
||||||
|
dnspython>=1.12.0
|
||||||
|
psutil>=1.1.1,<2.0.0
|
|
@ -0,0 +1,8 @@
|
||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
coverage>=3.6
|
||||||
|
mock>=1.2
|
||||||
|
flake8>=2.2.4,<=2.4.1
|
||||||
|
os-testr>=0.4.1
|
||||||
|
charm-tools
|
|
@ -0,0 +1,29 @@
|
||||||
|
[tox]
|
||||||
|
envlist = lint,py27
|
||||||
|
skipsdist = True
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
|
PYTHONHASHSEED=0
|
||||||
|
install_command =
|
||||||
|
pip install --allow-unverified python-apt {opts} {packages}
|
||||||
|
commands = ostestr {posargs}
|
||||||
|
|
||||||
|
[testenv:py27]
|
||||||
|
basepython = python2.7
|
||||||
|
deps = -r{toxinidir}/requirements.txt
|
||||||
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
|
[testenv:lint]
|
||||||
|
basepython = python2.7
|
||||||
|
deps = -r{toxinidir}/requirements.txt
|
||||||
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
commands = flake8 {posargs} hooks unit_tests tests actions lib
|
||||||
|
charm proof
|
||||||
|
|
||||||
|
[testenv:venv]
|
||||||
|
commands = {posargs}
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
ignore = E402,E226
|
||||||
|
exclude = hooks/charmhelpers
|
|
@ -6,7 +6,9 @@ import mock
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
|
||||||
with patch('lib.swift_utils.is_paused') as is_paused:
|
with patch('lib.swift_utils.is_paused') as is_paused:
|
||||||
|
with patch('lib.swift_utils.register_configs') as configs:
|
||||||
import actions.actions
|
import actions.actions
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,8 @@ import unittest
|
||||||
|
|
||||||
os.environ['JUJU_UNIT_NAME'] = 'swift-proxy'
|
os.environ['JUJU_UNIT_NAME'] = 'swift-proxy'
|
||||||
|
|
||||||
with patch('actions.charmhelpers.core.hookenv.config') as config:
|
with patch('lib.swift_utils.is_paused') as is_paused:
|
||||||
with patch('lib.swift_utils.is_paused') as is_paused:
|
with patch('lib.swift_utils.register_configs') as configs:
|
||||||
config.return_value = 'swift'
|
|
||||||
import actions.openstack_upgrade as openstack_upgrade
|
import actions.openstack_upgrade as openstack_upgrade
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class SwiftContextTestCase(unittest.TestCase):
|
||||||
mock_service_name.return_value = "testsvc"
|
mock_service_name.return_value = "testsvc"
|
||||||
tmpfile = tempfile.mktemp()
|
tmpfile = tempfile.mktemp()
|
||||||
swift_context.SWIFT_HASH_FILE = tmpfile
|
swift_context.SWIFT_HASH_FILE = tmpfile
|
||||||
with mock.patch('swift_context.os.environ.get') as mock_env_get:
|
with mock.patch('lib.swift_context.os.environ.get') as mock_env_get:
|
||||||
mock_env_get.return_value = str(uuid.uuid4())
|
mock_env_get.return_value = str(uuid.uuid4())
|
||||||
hash_ = swift_context.get_swift_hash()
|
hash_ = swift_context.get_swift_hash()
|
||||||
mock_env_get.assert_called_with('JUJU_ENV_UUID')
|
mock_env_get.assert_called_with('JUJU_ENV_UUID')
|
||||||
|
|
|
@ -149,7 +149,7 @@ class SwiftUtilsTestCase(unittest.TestCase):
|
||||||
self.assertEqual(devices, added_devices)
|
self.assertEqual(devices, added_devices)
|
||||||
|
|
||||||
# try re-adding, assert add_to_ring was not called
|
# try re-adding, assert add_to_ring was not called
|
||||||
with mock.patch('swift_utils.add_to_ring') as mock_add_to_ring:
|
with mock.patch('lib.swift_utils.add_to_ring') as mock_add_to_ring:
|
||||||
swift_utils.update_rings(nodes)
|
swift_utils.update_rings(nodes)
|
||||||
self.assertFalse(mock_add_to_ring.called)
|
self.assertFalse(mock_add_to_ring.called)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue