Merge pull request #11 from Mirantis/testable-resources

Testable resources
This commit is contained in:
Łukasz Oleś 2015-07-07 12:21:21 +02:00
commit eace9e3833
4 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,28 @@
import json
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),
json.dumps({
'auth': {
'tenantName': resource.args['tenant_name'].value,
'passwordCredentials': {
'username': resource.args['user_name'].value,
'password': resource.args['user_password'].value,
}
}
}),
headers={'Content-Type': 'application/json'}
)
token = token_data.json()['access']['token']['id']
print 'GLANCE TOKEN: {}'.format(token)
images = requests.get(
'http://%s:%s/v1/images' % (resource.args['ip'].value, resource.args['listen_port'].value),
headers={'X-Auth-Token': token}
)
assert images.json() == {'images': []}

View File

@ -0,0 +1,8 @@
import requests
def test(resource):
print 'Testing haproxy_service'
requests.get(
'http://%s:%s' % (resource.args['ip'].value, resource.args['ports'].value[0]['value'][0]['value'])
)

View File

@ -0,0 +1,8 @@
import requests
def test(resource):
print 'Testing keystone_service'
requests.get(
'http://%s:%s' % (resource.args['ip'].value, resource.args['port'].value)
)

View File

@ -0,0 +1,7 @@
import requests
def test(resource):
print 'Testing rabbitmq_service'
requests.get('http://%s:%s' % (resource.args['ip'].value, resource.args['management_port'].value))