Merge pull request #11 from Mirantis/testable-resources
Testable resources
This commit is contained in:
commit
eace9e3833
28
resources/glance_api_service/test.py
Normal file
28
resources/glance_api_service/test.py
Normal 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': []}
|
8
resources/haproxy_service/test.py
Normal file
8
resources/haproxy_service/test.py
Normal 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'])
|
||||
)
|
8
resources/keystone_service/test.py
Normal file
8
resources/keystone_service/test.py
Normal 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)
|
||||
)
|
7
resources/rabbitmq_service/test.py
Normal file
7
resources/rabbitmq_service/test.py
Normal 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))
|
Loading…
x
Reference in New Issue
Block a user