Merge "Update tests for the LMA plugins"

This commit is contained in:
Jenkins 2015-09-14 13:36:57 +00:00 committed by Gerrit Code Review
commit d603a159b7
2 changed files with 53 additions and 28 deletions

View File

@ -46,7 +46,7 @@ class TestInfluxdbPlugin(TestBasic):
3. Create cluster
4. Add 1 node with controller role
5. Add 1 node with compute role
6. Add 1 node with base-os role
6. Add 1 node with influxdb_grafana role
7. Deploy the cluster
8. Check that plugin is working
9. Run OSTF
@ -75,9 +75,10 @@ class TestInfluxdbPlugin(TestBasic):
plugin_name = 'influxdb_grafana'
options = {
'metadata/enabled': True,
'node_name/value': 'slave-03_base-os',
'node_name/value': 'slave-03_influxdb_grafana',
'influxdb_rootpass/value': 'lmapass',
'influxdb_userpass/value': 'lmapass',
'grafana_userpass/value': 'lmapass',
}
assert_true(
@ -91,7 +92,7 @@ class TestInfluxdbPlugin(TestBasic):
{
'slave-01': ['controller'],
'slave-02': ['compute'],
'slave-03': ['base-os']
'slave-03': ['influxdb_grafana']
}
)
@ -104,16 +105,20 @@ class TestInfluxdbPlugin(TestBasic):
logger.debug("Check that InfluxDB is ready")
r = requests.get(
"http://{}:8086/db/lma/series?u=lma&p={}&q=list+series".format(
influxdb_server_ip, options['influxdb_userpass/value']))
influxdb_url = "http://{0}:8086/query?db=lma&u={1}&p={2}&" + \
"q=show+measurements"
r = requests.get(influxdb_url.format(
influxdb_server_ip, 'lma', options['influxdb_userpass/value']))
msg = "InfluxDB responded with {}, expected 200".format(r.status_code)
assert_equal(r.status_code, 200, msg)
logger.debug("Check that the HTTP server is running")
logger.debug("Check that the Grafana server is running")
r = requests.get("http://{}/".format(influxdb_server_ip))
msg = "HTTP server responded with {}, expected 200".format(
r = requests.get(
"http://{0}:{1}@{2}:8000/api/org".format(
'grafana', options['grafana_userpass/value'],
influxdb_server_ip))
msg = "Grafana server responded with {}, expected 200".format(
r.status_code)
assert_equal(r.status_code, 200, msg)

View File

@ -47,7 +47,7 @@ class TestLmaCollectorPlugin(TestBasic):
3. Create cluster
4. Add 3 nodes with controller role
5. Add 1 node with compute + cinder role
6. Add 1 node with base-os role
6. Add 1 node with influxdb_grafana + elasticsearch roles
7. Deploy the cluster
8. Check that the plugins work
9. Run OSTF
@ -90,8 +90,11 @@ class TestLmaCollectorPlugin(TestBasic):
}
)
# this is how the base-os node will be named eventually
analytics_node_name = 'slave-05_base-os'
influxdb_user = "influxdb"
influxdb_pass = "influxdbpass"
influxdb_rootpass = "r00tme"
grafana_user = "grafana"
grafana_pass = "grafanapass"
plugins = [
{
'name': 'lma_collector',
@ -100,23 +103,23 @@ class TestLmaCollectorPlugin(TestBasic):
'environment_label/value': 'deploy_lma_collector_ha',
'elasticsearch_mode/value': 'local',
'influxdb_mode/value': 'local',
'influxdb_password/value': 'lmapass',
}
},
{
'name': 'elasticsearch_kibana',
'options': {
'metadata/enabled': True,
'node_name/value': analytics_node_name,
}
},
{
'name': 'influxdb_grafana',
'options': {
'metadata/enabled': True,
'node_name/value': analytics_node_name,
'influxdb_rootpass/value': 'lmapass',
'influxdb_userpass/value': 'lmapass',
'influxdb_rootpass/value': influxdb_rootpass,
'influxdb_username/value': influxdb_user,
'influxdb_userpass/value': influxdb_pass,
'grafana_username/value': grafana_user,
'grafana_userpass/value': grafana_pass,
}
},
]
@ -130,6 +133,7 @@ class TestLmaCollectorPlugin(TestBasic):
self.fuel_web.update_plugin_data(cluster_id, plugin_name,
plugin['options'])
analytics_roles = ["influxdb_grafana", "elasticsearch_kibana"]
self.fuel_web.update_nodes(
cluster_id,
{
@ -137,13 +141,20 @@ class TestLmaCollectorPlugin(TestBasic):
"slave-02": ["controller"],
"slave-03": ["controller"],
"slave-04": ["compute", "cinder"],
"slave-05": ["base-os"]
"slave-05": analytics_roles,
}
)
self.fuel_web.deploy_cluster_wait(cluster_id)
analytics_node_ip = self.fuel_web.get_nailgun_node_by_name(
"slave-05").get('ip')
analytics_nodes = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
cluster_id, analytics_roles
)
msg = "One node with '{}' roles must be present, found {}".format(
' + '.join(analytics_roles), len(analytics_nodes))
assert_true(len(analytics_nodes) == 1, msg)
analytics_node_ip = analytics_nodes[0].get('ip')
assert_is_not_none(
analytics_node_ip,
"Fail to retrieve the IP address for slave-05"
@ -156,18 +167,27 @@ class TestLmaCollectorPlugin(TestBasic):
url, r.status_code, expected))
logger.debug("Check that Elasticsearch is ready")
assert_http_get_response("http://{}:9200/".format(analytics_node_ip))
assert_http_get_response("http://{0}:9200/".format(analytics_node_ip))
logger.debug("Check that Kibana is ready")
assert_http_get_response("http://{}/".format(analytics_node_ip))
assert_http_get_response("http://{0}/".format(analytics_node_ip))
logger.debug("Check that InfluxDB is ready")
logger.debug("Check that the root user can access InfluxDB")
influxdb_url = "http://{0}:8086/query?db=lma&u={1}&p={2}&" + \
"q=show+measurements"
assert_http_get_response(influxdb_url.format(analytics_node_ip,
'root',
influxdb_rootpass))
logger.debug("Check that the LMA user can access InfluxDB")
assert_http_get_response(influxdb_url.format(analytics_node_ip,
influxdb_user,
influxdb_pass))
logger.debug("Check that the LMA user can access Grafana")
assert_http_get_response(
"http://{}:8086/db/lma/series?u=lma&p={}&q=list+series".format(
analytics_node_ip, "lmapass"))
logger.debug("Check that Grafana is ready")
assert_http_get_response("http://{}/".format(analytics_node_ip))
"http://{0}:{1}@{2}:8000/api/org".format(grafana_user,
grafana_pass,
analytics_node_ip))
self.fuel_web.run_ostf(cluster_id=cluster_id)