Various fixes for example.py and resource testing

This commit is contained in:
Przemyslaw Kaminski 2015-07-08 09:49:26 +02:00
parent 7323a842da
commit 118acbcfa3
4 changed files with 15 additions and 11 deletions

View File

@ -5,7 +5,7 @@ import sys
import time
from solar.core import actions
from solar.core import virtual_resource as vr
from solar.core.resource import virtual_resource as vr
from solar.core import resource
from solar.core import signals
from solar.core import testing
@ -161,8 +161,8 @@ def deploy():
signals.connect(glance_config, glance_api_container, {'config_dir': 'host_binds'})
signals.connect(glance_db_user, glance_api_container, {'user_password': 'db_password'})
signals.connect(glance_keystone_user, glance_api_container, {'user_password': 'keystone_password'})
signals.connect(glance_keystone_user, glance_api_container, {'admin_token': 'keystone_admin_token'})
signals.connect(glance_keystone_user, glance_api_container, {'admin_token': 'keystone_admin_token', 'user_password': 'keystone_password'})
signals.connect(haproxy_keystone_config, glance_api_container, {'listen_port': 'keystone_port'})
signals.connect(haproxy_config, glance_api_container, {'ip': 'keystone_host'})
signals.connect(node2, glance_registry_container)

View File

@ -36,5 +36,8 @@ input:
keystone_host:
schema: str!
value:
keystone_port:
schema: int!
value:
tags: [resource/container]

View File

@ -5,13 +5,13 @@ import requests
def test(resource):
print 'Testing glance_service'
token_data = requests.post(
'http://%s:%s/v2.0/tokens' % (resource.args['ip'].value, resource.args['listen_port'].value),
'http://%s:%s/v2.0/tokens' % (resource.args['ip'].value, resource.args['keystone_port'].value),
json.dumps({
'auth': {
'tenantName': resource.args['tenant_name'].value,
'tenantName': 'services',
'passwordCredentials': {
'username': resource.args['user_name'].value,
'password': resource.args['user_password'].value,
'username': 'glance_admin',
'password': resource.args['keystone_password'].value,
}
}
}),
@ -22,7 +22,7 @@ def test(resource):
print 'GLANCE TOKEN: {}'.format(token)
images = requests.get(
'http://%s:%s/v1/images' % (resource.args['ip'].value, resource.args['listen_port'].value),
'http://%s:%s/v1/images' % (resource.args['ip'].value, 9393),
headers={'X-Auth-Token': token}
)
assert images.json() == {'images': []}

View File

@ -8,15 +8,16 @@ from solar.core import signals
def test_all():
conn_graph = signals.detailed_connection_graph()
srt = nx.topological_sort(conn_graph)
#srt = nx.topological_sort(conn_graph)
for name in srt:
for name in conn_graph:
print 'Trying {}'.format(name)
r = resource.load(name)
script_path = os.path.join(r.metadata['base_path'], 'test.py')
if not os.path.exists(script_path):
print 'WARNING: resource {} has no tests'.format(name)
continue
print 'File {} found'.format(script_path)