diff options
author | Ace Lee <liyin11@huawei.com> | 2018-01-09 03:19:09 +0000 |
---|---|---|
committer | liyin <liyin11@huawei.com> | 2018-02-26 08:58:07 +0000 |
commit | 06db2e37272bb3a030c2b5f2e255ec6a61f17472 (patch) | |
tree | e858fe31ec183eb4ff326f16763856db543e9d83 /testsuites/posca/testcase_dashboard | |
parent | c79a7da0de95b42f66c2a6f214372514c9c246db (diff) |
Moon testcase bug fix
JIRA: BOTTLENECK-220
The JIRA ticket is to suit moon version 4.3.
There are some bugs to fix.
Change-Id: Idf8b9a2b4dea6508738283e76457b8d1d25ceae9
Signed-off-by: Ace Lee <liyin11@huawei.com>
Diffstat (limited to 'testsuites/posca/testcase_dashboard')
8 files changed, 255 insertions, 0 deletions
diff --git a/testsuites/posca/testcase_dashboard/posca_feature_moon.py b/testsuites/posca/testcase_dashboard/posca_feature_moon.py new file mode 100644 index 00000000..6819ea84 --- /dev/null +++ b/testsuites/posca/testcase_dashboard/posca_feature_moon.py @@ -0,0 +1,121 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +'''This file realize a function of creating dashboard of stress ping test''' +import ConfigParser +from elasticsearch import Elasticsearch +import json +import os +import utils.logger as log +from utils.parser import Parser as conf_parser + +LOG = log.Logger(__name__).getLogger() +config = ConfigParser.ConfigParser() +es = Elasticsearch() +dashboard_path = os.path.join(conf_parser.test_dir, + "posca", + "testcase_dashboard") +dashboard_dir = dashboard_path + "/" + + +def dashboard_send_data(runner_config, test_data): + global es + print runner_config + es_ip = runner_config['dashboard_ip'].split(':') + es = Elasticsearch([{'host': es_ip[0]}]) + print test_data["test_body"] + res = es.index(index="bottlenecks", + doc_type=test_data["testcase"], + body=test_data["test_body"][0]) + if res['created'] == "False": + LOG.error("date send to kibana have errors ", test_data["data_body"]) + + +def posca_moon_init(runner_config): + global es + es_ip = runner_config['dashboard_ip'].split(':') + es = Elasticsearch([{'host': es_ip[0]}]) + # Create bottlenecks index + with open(dashboard_dir + 'posca_feature_moon_index_pattern.json')\ + as index_pattern: + doc = json.load(index_pattern) + res = es.index( + index=".kibana", + doc_type="index-pattern", + id="bottlenecks", + body=doc) + if res['created'] == "True": + LOG.info("bottlenecks index-pattern has created") + else: + LOG.info("bottlenecks index-pattern has existed") + + with open(dashboard_dir + 'posca_system_bandwidth_config.json')\ + as index_config: + doc = json.load(index_config) + res = es.index(index=".kibana", doc_type="config", id="4.6.1", body=doc) + if res['created'] == "True": + LOG.info("bottlenecks config has created") + else: + LOG.info("bottlenecks config has existed") + + # Configure discover panel + with open(dashboard_dir + 'posca_feature_moon_discover.json')\ + as index_discover: + doc = json.load(index_discover) + res = es.index( + index=".kibana", + doc_type="search", + id="moon", + body=doc) + if res['created'] == "True": + LOG.info("moon testcase search has created") + else: + LOG.info("moon testcase search has existed") + + # Create testing data in line graph + with open(dashboard_dir + 'posca_feature_moon_resources_histogram.json')\ + as line_data: + doc = json.load(line_data) + res = es.index( + index=".kibana", + doc_type="visualization", + id="resources", + body=doc) + if res['created'] == "True": + LOG.info("moon resources visualization has created") + else: + LOG.info("moon resources visualization has existed") + + # Create comparison results in line chart + with open(dashboard_dir + 'posca_feature_moon_tenants_histogram.json')\ + as line_char: + doc = json.load(line_char) + res = es.index( + index=".kibana", + doc_type="visualization", + id="tenants", + body=doc) + if res['created'] == "True": + LOG.info("moon tenants visualization has created") + else: + LOG.info("moon tenants visualization has existed") + + # Create dashboard + with open(dashboard_dir + 'posca_feature_moon_dashboard.json')\ + as dashboard: + doc = json.load(dashboard) + res = es.index( + index=".kibana", + doc_type="dashboard", + id="moon", + body=doc) + if res['created'] == "True": + LOG.info("moon testcases dashboard has created") + else: + LOG.info("moon testcases dashboard has existed") diff --git a/testsuites/posca/testcase_dashboard/posca_feature_moon_dashboard.json b/testsuites/posca/testcase_dashboard/posca_feature_moon_dashboard.json new file mode 100644 index 00000000..53a4a750 --- /dev/null +++ b/testsuites/posca/testcase_dashboard/posca_feature_moon_dashboard.json @@ -0,0 +1,13 @@ +{ + "title": "moon", + "hits": 0, + "description": "", + "panelsJSON": "[{\"id\":\"resources\",\"type\":\"visualization\",\"panelIndex\":1,\"size_x\":8,\"size_y\":7,\"col\":1,\"row\":1},{\"id\":\"tenants\",\"type\":\"visualization\",\"panelIndex\":2,\"size_x\":3,\"size_y\":7,\"col\":9,\"row\":1}]", + "optionsJSON": "{\"darkTheme\":false}", + "uiStateJSON": "{}", + "version": 1, + "timeRestore": false, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[{\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}}}]}" + } +}
\ No newline at end of file diff --git a/testsuites/posca/testcase_dashboard/posca_feature_moon_index_pattern.json b/testsuites/posca/testcase_dashboard/posca_feature_moon_index_pattern.json new file mode 100644 index 00000000..2bff871a --- /dev/null +++ b/testsuites/posca/testcase_dashboard/posca_feature_moon_index_pattern.json @@ -0,0 +1,4 @@ +{ + "title": "bottlenecks", + "fields": "[{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"tenant_max\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"max_user\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"tenant_number\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":true,\"analyzed\":false,\"doc_values\":true},{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"indexed\":false,\"analyzed\":false,\"doc_values\":false}]" +}
\ No newline at end of file diff --git a/testsuites/posca/testcase_dashboard/posca_feature_moon_resources_histogram.json b/testsuites/posca/testcase_dashboard/posca_feature_moon_resources_histogram.json new file mode 100644 index 00000000..c8977a72 --- /dev/null +++ b/testsuites/posca/testcase_dashboard/posca_feature_moon_resources_histogram.json @@ -0,0 +1,11 @@ +{ + "title": "resources", + "visState": "{\"title\":\"New Visualization\",\"type\":\"histogram\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"scale\":\"linear\",\"mode\":\"stacked\",\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{}},\"aggs\":[{\"id\":\"1\",\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"max_user\"}},{\"id\":\"2\",\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"tenant_number\",\"size\":5,\"order\":\"asc\",\"orderBy\":\"_term\"}}],\"listeners\":{}}", + "uiStateJSON": "{}", + "description": "", + "savedSearchId": "moon", + "version": 1, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[]}" + } +}
\ No newline at end of file diff --git a/testsuites/posca/testcase_dashboard/posca_feature_moon_tenants_discover.json b/testsuites/posca/testcase_dashboard/posca_feature_moon_tenants_discover.json new file mode 100644 index 00000000..03360f89 --- /dev/null +++ b/testsuites/posca/testcase_dashboard/posca_feature_moon_tenants_discover.json @@ -0,0 +1,23 @@ +{ + "_index": ".kibana", + "_type": "search", + "_id": "tenants", + "_version": 1, + "found": true, + "_source": { + "title": "tenants", + "description": "", + "hits": 0, + "columns": [ + "_source" + ], + "sort": [ + "_score", + "desc" + ], + "version": 1, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"index\":\"bottlenecks\",\"filter\":[],\"highlight\":{\"pre_tags\":[\"@kibana-highlighted-field@\"],\"post_tags\":[\"@/kibana-highlighted-field@\"],\"fields\":{\"*\":{}},\"require_field_match\":false,\"fragment_size\":2147483647},\"query\":{\"query_string\":{\"query\":\"_type:posca_factor_moon_tenants\",\"analyze_wildcard\":true}}}" + } + } +}
\ No newline at end of file diff --git a/testsuites/posca/testcase_dashboard/posca_feature_moon_tenants_histogram.json b/testsuites/posca/testcase_dashboard/posca_feature_moon_tenants_histogram.json new file mode 100644 index 00000000..a731acfc --- /dev/null +++ b/testsuites/posca/testcase_dashboard/posca_feature_moon_tenants_histogram.json @@ -0,0 +1,11 @@ +{ + "title": "tenants", + "visState": "{\"title\":\"New Visualization\",\"type\":\"histogram\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"scale\":\"linear\",\"mode\":\"stacked\",\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{}},\"aggs\":[{\"id\":\"1\",\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"tenant_max\"}}],\"listeners\":{}}", + "uiStateJSON": "{}", + "description": "", + "savedSearchId": "moon", + "version": 1, + "kibanaSavedObjectMeta": { + "searchSourceJSON": "{\"filter\":[]}" + } +}
\ No newline at end of file diff --git a/testsuites/posca/testcase_dashboard/posca_moon_resources.py b/testsuites/posca/testcase_dashboard/posca_moon_resources.py new file mode 100644 index 00000000..446faccc --- /dev/null +++ b/testsuites/posca/testcase_dashboard/posca_moon_resources.py @@ -0,0 +1,36 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +'''This file realize a function of creating dashboard of stress ping test''' +import ConfigParser +from elasticsearch import Elasticsearch +import os +import utils.logger as log +from utils.parser import Parser as conf_parser + +LOG = log.Logger(__name__).getLogger() +config = ConfigParser.ConfigParser() +es = Elasticsearch() +dashboard_path = os.path.join(conf_parser.test_dir, + "posca", + "testcase_dashboard") +dashboard_dir = dashboard_path + "/" + + +def dashboard_send_data(runner_config, test_data): + global es + print runner_config + es_ip = runner_config['dashboard_ip'].split(':') + es = Elasticsearch([{'host': es_ip[0]}]) + print test_data["test_body"] + res = es.index(index="bottlenecks", + doc_type=test_data["testcase"], + body=test_data["test_body"][0]) + if res['created'] == "False": + LOG.error("date send to kibana have errors ", test_data["data_body"]) diff --git a/testsuites/posca/testcase_dashboard/posca_moon_tenants.py b/testsuites/posca/testcase_dashboard/posca_moon_tenants.py new file mode 100644 index 00000000..446faccc --- /dev/null +++ b/testsuites/posca/testcase_dashboard/posca_moon_tenants.py @@ -0,0 +1,36 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +'''This file realize a function of creating dashboard of stress ping test''' +import ConfigParser +from elasticsearch import Elasticsearch +import os +import utils.logger as log +from utils.parser import Parser as conf_parser + +LOG = log.Logger(__name__).getLogger() +config = ConfigParser.ConfigParser() +es = Elasticsearch() +dashboard_path = os.path.join(conf_parser.test_dir, + "posca", + "testcase_dashboard") +dashboard_dir = dashboard_path + "/" + + +def dashboard_send_data(runner_config, test_data): + global es + print runner_config + es_ip = runner_config['dashboard_ip'].split(':') + es = Elasticsearch([{'host': es_ip[0]}]) + print test_data["test_body"] + res = es.index(index="bottlenecks", + doc_type=test_data["testcase"], + body=test_data["test_body"][0]) + if res['created'] == "False": + LOG.error("date send to kibana have errors ", test_data["data_body"]) |