diff options
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/docs-build.sh | 16 | ||||
-rwxr-xr-x | utils/jenkins-jnlp-connect.sh | 15 | ||||
-rw-r--r-- | utils/test/dashboard/css/bootstrap.min.css (renamed from utils/test/result_collection_api/tools/dashboard/css/bootstrap.min.css) | 0 | ||||
-rw-r--r-- | utils/test/dashboard/css/opnfv_dashboard_tests.css (renamed from utils/test/result_collection_api/tools/dashboard/css/opnfv_dashboard_tests.css) | 0 | ||||
-rw-r--r-- | utils/test/dashboard/js/bootstrap.min.js (renamed from utils/test/result_collection_api/tools/dashboard/js/bootstrap.min.js) | 0 | ||||
-rw-r--r-- | utils/test/dashboard/js/dygraph-combined.js (renamed from utils/test/result_collection_api/tools/dashboard/js/dygraph-combined.js) | 0 | ||||
-rw-r--r-- | utils/test/dashboard/js/jquery-2.2.0.min.js (renamed from utils/test/result_collection_api/tools/dashboard/js/jquery-2.2.0.min.js) | 0 | ||||
-rw-r--r-- | utils/test/dashboard/js/opnfv_dashboard_tests.js (renamed from utils/test/result_collection_api/tools/dashboard/js/opnfv_dashboard_tests.js) | 0 | ||||
-rw-r--r-- | utils/test/dashboard/js/opnfv_dashboard_tests_conf.js (renamed from utils/test/result_collection_api/tools/dashboard/js/opnfv_dashboard_tests_conf.js) | 0 | ||||
-rw-r--r-- | utils/test/dashboard/opnfv_dashboard_tests.html (renamed from utils/test/result_collection_api/tools/dashboard/opnfv_dashboard_tests.html) | 0 | ||||
-rw-r--r-- | utils/test/reporting/default.css (renamed from utils/test/result_collection_api/tools/reporting/default.css) | 0 | ||||
-rw-r--r-- | utils/test/reporting/img/weather-clear.png | bin | 0 -> 1560 bytes | |||
-rw-r--r-- | utils/test/reporting/img/weather-few-clouds.png | bin | 0 -> 1927 bytes | |||
-rw-r--r-- | utils/test/reporting/img/weather-overcast.png | bin | 0 -> 1588 bytes | |||
-rw-r--r-- | utils/test/reporting/img/weather-storm.png | bin | 0 -> 2137 bytes | |||
-rw-r--r-- | utils/test/reporting/index-status-tmpl.html | 92 | ||||
-rw-r--r-- | utils/test/reporting/index-tempest-tmpl.html | 90 | ||||
-rw-r--r-- | utils/test/reporting/index-vims-tmpl.html (renamed from utils/test/result_collection_api/tools/reporting/index-tmpl.html) | 12 | ||||
-rw-r--r-- | utils/test/reporting/index.html | 52 | ||||
-rw-r--r-- | utils/test/reporting/reporting-status.py | 178 | ||||
-rw-r--r-- | utils/test/reporting/reporting-tempest.py | 99 | ||||
-rw-r--r-- | utils/test/reporting/reporting-vims.py (renamed from utils/test/result_collection_api/tools/reporting/reporting.py) | 6 | ||||
-rw-r--r-- | utils/test/result_collection_api/resources/handlers.py | 10 | ||||
-rw-r--r-- | utils/test/result_collection_api/resources/models.py | 12 | ||||
-rw-r--r-- | utils/test/result_collection_api/samples/sample.json.postman_collection (renamed from utils/test/result_collection_api/tools/samples/sample.json.postman_collection) | 0 | ||||
-rw-r--r-- | utils/test/scripts/backup-db.sh (renamed from utils/test/result_collection_api/tools/backup-db.sh) | 0 |
26 files changed, 561 insertions, 21 deletions
diff --git a/utils/docs-build.sh b/utils/docs-build.sh index 4d95836d5..48037db2e 100755 --- a/utils/docs-build.sh +++ b/utils/docs-build.sh @@ -14,6 +14,7 @@ INDEX_RST=${INDEX_RST:-index.rst} BUILD_DIR=${BUILD_DIR:-docs_build} OUTPUT_DIR=${OUTPUT_DIR:-docs_output} SRC_DIR=${SRC_DIR:-$BUILD_DIR/_src} +VENV_DIR=${VENV_DIR:-$BUILD_DIR/_venv} RELENG_DIR=${RELENG_DIR:-releng} GERRIT_COMMENT=${GERRIT_COMMENT:-} @@ -48,10 +49,6 @@ opnfv_logo='releng/docs/etc/opnfv-logo.png' function check_rst_doc() { _src="$1" - if ! which doc8 > /dev/null ; then - echo "Error: 'doc8' not found. Exec 'sudo pip install doc8' first." - exit 1 - fi # Note: This check may fail in many jobs for building project docs, since # the old sample has lines more than 120. We ignore failures on this # check right now, but these have to be fixed before OPNFV B release. @@ -140,6 +137,15 @@ fi prepare_src_files +if ! which virtualenv > /dev/null ; then + echo "Error: 'virtualenv' not found. Exec 'sudo pip install virtualenv' first." + exit 1 +fi + +virtualenv "$VENV_DIR" +source "$VENV_DIR/bin/activate" +pip install -r "$RELENG_DIR/docs/etc/requirements.txt" + find $DOCS_DIR -name $INDEX_RST -printf '%h\n' | while read dir do name=$(generate_name $dir) @@ -224,3 +230,5 @@ do fi done + +deactivate diff --git a/utils/jenkins-jnlp-connect.sh b/utils/jenkins-jnlp-connect.sh index 6fb6827fd..10ac50b0a 100755 --- a/utils/jenkins-jnlp-connect.sh +++ b/utils/jenkins-jnlp-connect.sh @@ -48,10 +48,14 @@ if [[ $(whoami) != "root" && $(whoami) != "$jenkinsuser" ]]; then exit 1 fi -if [[ $distro == Debian || $distro == Ubuntu ]]; then +if [ -d /etc/monit/conf.d ]; then monitconfdir="/etc/monit/conf.d/" -elif [[ $distro == Fedora || $distro == CentOS || $distro == Redhat ]]; then +elif [ -d /etc/monit.d ]; then monitconfdir="/etc/monit.d" +else + echo "Could not determine the location of the monit configuration file." + echo "Make sure monit is installed." + exit 1 fi #make pid dir @@ -96,8 +100,8 @@ if [[ -f $monitconfdir/jenkins ]]; then #test for diff if [[ "$(diff $monitconfdir/jenkins <(echo "\ check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid -start program = \"usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $dir; export started_monit=true; $0 $@'\" -stop program = \" /bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"\ +start program = \"/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $dir; export started_monit=true; $0 $@'\" +stop program = \"/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"\ ") )" ]]; then echo "Updating monit config..." makemonit $@ @@ -123,7 +127,7 @@ then echo "pid file found" fi fi -if [[ run_in_foreground == true ]]; then +if [[ $run_in_foreground == true ]]; then $connectionstring else exec $connectionstring & @@ -186,6 +190,5 @@ do done connectionstring="java -jar slave.jar -jnlpUrl https://build.opnfv.org/ci/computer/"$slave_name"/slave-agent.jnlp -secret "$slave_secret" -noCertificateCheck " -distro="$(tr -s ' \011' '\012' < /etc/issue | head -n 1)" main "$@" diff --git a/utils/test/result_collection_api/tools/dashboard/css/bootstrap.min.css b/utils/test/dashboard/css/bootstrap.min.css index 4cf729e43..4cf729e43 100644 --- a/utils/test/result_collection_api/tools/dashboard/css/bootstrap.min.css +++ b/utils/test/dashboard/css/bootstrap.min.css diff --git a/utils/test/result_collection_api/tools/dashboard/css/opnfv_dashboard_tests.css b/utils/test/dashboard/css/opnfv_dashboard_tests.css index 894725bb2..894725bb2 100644 --- a/utils/test/result_collection_api/tools/dashboard/css/opnfv_dashboard_tests.css +++ b/utils/test/dashboard/css/opnfv_dashboard_tests.css diff --git a/utils/test/result_collection_api/tools/dashboard/js/bootstrap.min.js b/utils/test/dashboard/js/bootstrap.min.js index e79c06513..e79c06513 100644 --- a/utils/test/result_collection_api/tools/dashboard/js/bootstrap.min.js +++ b/utils/test/dashboard/js/bootstrap.min.js diff --git a/utils/test/result_collection_api/tools/dashboard/js/dygraph-combined.js b/utils/test/dashboard/js/dygraph-combined.js index 7d6121e1d..7d6121e1d 100644 --- a/utils/test/result_collection_api/tools/dashboard/js/dygraph-combined.js +++ b/utils/test/dashboard/js/dygraph-combined.js diff --git a/utils/test/result_collection_api/tools/dashboard/js/jquery-2.2.0.min.js b/utils/test/dashboard/js/jquery-2.2.0.min.js index 06ac26315..06ac26315 100644 --- a/utils/test/result_collection_api/tools/dashboard/js/jquery-2.2.0.min.js +++ b/utils/test/dashboard/js/jquery-2.2.0.min.js diff --git a/utils/test/result_collection_api/tools/dashboard/js/opnfv_dashboard_tests.js b/utils/test/dashboard/js/opnfv_dashboard_tests.js index e5bcca625..e5bcca625 100644 --- a/utils/test/result_collection_api/tools/dashboard/js/opnfv_dashboard_tests.js +++ b/utils/test/dashboard/js/opnfv_dashboard_tests.js diff --git a/utils/test/result_collection_api/tools/dashboard/js/opnfv_dashboard_tests_conf.js b/utils/test/dashboard/js/opnfv_dashboard_tests_conf.js index 6778332eb..6778332eb 100644 --- a/utils/test/result_collection_api/tools/dashboard/js/opnfv_dashboard_tests_conf.js +++ b/utils/test/dashboard/js/opnfv_dashboard_tests_conf.js diff --git a/utils/test/result_collection_api/tools/dashboard/opnfv_dashboard_tests.html b/utils/test/dashboard/opnfv_dashboard_tests.html index 424b525a3..424b525a3 100644 --- a/utils/test/result_collection_api/tools/dashboard/opnfv_dashboard_tests.html +++ b/utils/test/dashboard/opnfv_dashboard_tests.html diff --git a/utils/test/result_collection_api/tools/reporting/default.css b/utils/test/reporting/default.css index 0e330e965..0e330e965 100644 --- a/utils/test/result_collection_api/tools/reporting/default.css +++ b/utils/test/reporting/default.css diff --git a/utils/test/reporting/img/weather-clear.png b/utils/test/reporting/img/weather-clear.png Binary files differnew file mode 100644 index 000000000..a0d967750 --- /dev/null +++ b/utils/test/reporting/img/weather-clear.png diff --git a/utils/test/reporting/img/weather-few-clouds.png b/utils/test/reporting/img/weather-few-clouds.png Binary files differnew file mode 100644 index 000000000..acfa78398 --- /dev/null +++ b/utils/test/reporting/img/weather-few-clouds.png diff --git a/utils/test/reporting/img/weather-overcast.png b/utils/test/reporting/img/weather-overcast.png Binary files differnew file mode 100644 index 000000000..4296246d0 --- /dev/null +++ b/utils/test/reporting/img/weather-overcast.png diff --git a/utils/test/reporting/img/weather-storm.png b/utils/test/reporting/img/weather-storm.png Binary files differnew file mode 100644 index 000000000..956f0e20f --- /dev/null +++ b/utils/test/reporting/img/weather-storm.png diff --git a/utils/test/reporting/index-status-tmpl.html b/utils/test/reporting/index-status-tmpl.html new file mode 100644 index 000000000..130ecd5c1 --- /dev/null +++ b/utils/test/reporting/index-status-tmpl.html @@ -0,0 +1,92 @@ + <html> + <head> + <meta charset="utf-8"> + <!-- Bootstrap core CSS --> + <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> + <link href="default.css" rel="stylesheet"> + <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> + <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> + <script type="text/javascript"> + $(document).ready(function (){ + $(".btn-more").click(function() { + $(this).hide(); + $(this).parent().find(".panel-default").show(); + }); + }) + </script> + </head> + <body> + <div class="container"> + <div class="masthead"> + <h3 class="text-muted">Functest status page</h3> + <nav> + <ul class="nav nav-justified"> + <li class="active"><a href="index.html">Home</a></li> + <li><a href="index-status-apex.html">Apex</a></li> + <li><a href="index-status-compass.html">Compass</a></li> + <li><a href="index-status-fuel.html">Fuel</a></li> + <li><a href="index-status-joid.html">Joid</a></li> + </ul> + </nav> + </div> +<div class="row"> + <div class="col-md-1"></div> + <div class="col-md-10"> + <div class="page-header"> + <h2>{{installer}}</h2> + </div> + + <div class="scenario-overview"> + <div class="panel-heading"><h4><b>List of last scenarios run over the last 7 days </b></h4></div> + <table class="table"> + <tr> + <th width="80%">Scenario</th> + <th width="20%">Iteration</th> + </tr> + {% for scenario,iteration in scenario_stats.iteritems() -%} + <tr class="tr-ok"> + <td>{{scenario}}</td> + <td>{{iteration}}</td> + </tr> + {%- endfor %} + </table> + </div> + + + + {% for scenario, iteration in scenario_stats.iteritems() -%} + <div class="scenario-part"> + <div class="page-header"> + <h3><span class="glyphicon glyphicon-chevron-right"> <b>{{scenario}}</b></h3> + </div> + <div class="panel panel-default"> + <div class="panel-heading"> + <span class="panel-header-item"> + </span> + </div> + <table class="table"> + <tr> + {% for test in items[scenario] -%} + <th>{{test.getName() }}</th> + {%- endfor %} + </tr> + <tr class="tr-weather-weather"> + {% for test in items[scenario] -%} + {% if test.getCriteria() > 3 -%} + <td><img src="./img/weather-clear.png"></td> + {%- elif test.getCriteria() > 2 -%} + <td><img src="./img/weather-few-clouds.png"></td> + {%- elif test.getCriteria() > 1 -%} + <td><img src="./img/weather-overcast.png"></td> + {%- else -%} + <td><img src="./img/weather-storm.png"></td> + {%- endif %} + {%- endfor %} + </tr> + </table> + </div> + </div> + {%- endfor %} + </div> + <div class="col-md-1"></div> +</div> diff --git a/utils/test/reporting/index-tempest-tmpl.html b/utils/test/reporting/index-tempest-tmpl.html new file mode 100644 index 000000000..be0b79734 --- /dev/null +++ b/utils/test/reporting/index-tempest-tmpl.html @@ -0,0 +1,90 @@ + <html> + <head> + <meta charset="utf-8"> + <!-- Bootstrap core CSS --> + <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> + <link href="default.css" rel="stylesheet"> + <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> + <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> + <script type="text/javascript"> + $(document).ready(function (){ + $(".btn-more").click(function() { + $(this).hide(); + $(this).parent().find(".panel-default").show(); + }); + }) + </script> + </head> + <body> + <div class="container"> + <div class="masthead"> + <h3 class="text-muted">Tempest status page</h3> + <nav> + <ul class="nav nav-justified"> + <li class="active"><a href="index.html">Home</a></li> + <li><a href="index-tempest-apex.html">Apex</a></li> + <li><a href="index-tempest-compass.html">Compass</a></li> + <li><a href="index-tempest-fuel.html">Fuel</a></li> + <li><a href="index-tempest-joid.html">Joid</a></li> + </ul> + </nav> + </div> +<div class="row"> + <div class="col-md-1"></div> + <div class="col-md-10"> + <div class="page-header"> + <h2>{{installer}}</h2> + </div> + {% for scenario_name, results in scenario_results.iteritems() -%} + <div class="scenario-part"> + <div class="page-header"> + <h3><span class="glyphicon glyphicon-chevron-right"> <b>{{scenario_name}}</b></h3> + </div> + {% for result in results -%} + {% if loop.index > 2 -%} + <div class="panel panel-default" hidden> + {%- else -%} + <div class="panel panel-default"> + {%- endif %} + <div class="panel-heading"> + <div class="progress-bar" role="progressbar" aria-valuenow="{{result.pr_step_ok}}" aria-valuemin="0" aria-valuemax="100" style="width: {{result.pr_step_ok}}%"></div> + <span class="panel-header-item"> + <h4><b>{{result.creation_date}}</b></h4> + </span> + <span class="badge panel-pod-name">{{result.pod_name}}</span> + </div> + <table class="table"> + <tr> + <th width="20%">Item</th> + <th width="10%">Result</th> + <th width="10%">Status</th> + <th width="60%">Errors</th> + </tr> + {% for item in items -%} + {% if item in result.details.keys() -%} + {% if result.criteria[item] -%} + <tr class="tr-ok"> + <td>{{item}}</td> + <td>{{result.details[item]}}</td> + <td><span class="glyphicon glyphicon-ok"></td> + <td>{{result.errors[item]}}</td> + </tr> + {%- else -%} + <tr class="tr-danger"> + <td>{{item}}</td> + <td>{{result.details[item]}}</td> + <td><span class="glyphicon glyphicon-remove"></td> + <td>{{result.errors[item]}}</td> + </tr> + {%- endif %} + {%- endif %} + {%- endfor %} + </table> + </div> + {%- endfor %} + <button type="button" class="btn btn-more">More than two</button> + </div> + {%- endfor %} + </div> + <div class="col-md-1"></div> +</div> diff --git a/utils/test/result_collection_api/tools/reporting/index-tmpl.html b/utils/test/reporting/index-vims-tmpl.html index 4d1c50915..8858182c1 100644 --- a/utils/test/result_collection_api/tools/reporting/index-tmpl.html +++ b/utils/test/reporting/index-vims-tmpl.html @@ -21,11 +21,11 @@ <h3 class="text-muted">vIMS status page</h3> <nav> <ul class="nav nav-justified"> - <li class="active"><a href="#">Home</a></li> - <li><a href="index-fuel.html">Fuel</a></li> - <li><a href="index-compass.html">Compass</a></li> - <li><a href="index-joid.html">JOID</a></li> - <li><a href="index-apex.html">APEX</a></li> + <li class="active"><a href="index.html">Home</a></li> + <li><a href="index-vims-fuel.html">Fuel</a></li> + <li><a href="index--vims-compass.html">Compass</a></li> + <li><a href="index-vims-joid.html">JOID</a></li> + <li><a href="index-vims-apex.html">APEX</a></li> </ul> </nav> </div> @@ -88,4 +88,4 @@ {%- endfor %} </div> <div class="col-md-1"></div> -</div>
\ No newline at end of file +</div> diff --git a/utils/test/reporting/index.html b/utils/test/reporting/index.html new file mode 100644 index 000000000..af4033567 --- /dev/null +++ b/utils/test/reporting/index.html @@ -0,0 +1,52 @@ + <html> + <head> + <meta charset="utf-8"> + <!-- Bootstrap core CSS --> + <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> + <link href="default.css" rel="stylesheet"> + <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> + <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> + <script type="text/javascript"> + $(document).ready(function (){ + $(".btn-more").click(function() { + $(this).hide(); + $(this).parent().find(".panel-default").show(); + }); + }) + </script> + </head> + <body> + <div class="container"> + <div class="masthead"> + <h3 class="text-muted">Functest reporting page</h3> + <nav> + <ul class="nav nav-justified"> + <li class="active"><a href="#">Home</a></li> + <li><a href="./index-status-apex.html">Status</a></li> + <li><a href="./index-tempest-apex.html">Tempest</a></li> + <li><a href="./index-vims-apex.html">vIMS</a></li> + </ul> + </nav> + </div> +<div class="row"> + <div class="col-md-1"></div> + <div class="col-md-10"> + <div class="page-main"> + <h2>Functest</h2> + This project develops test suites that cover functionaling test cases in OPNFV. + <br>The test suites are integrated in the continuation integration (CI) framework and used to evaluate/validate scenario. + <br> Weekly meeting: every Tuesday 8 AM UTC + <br> IRC chan #opnfv-testperf + + <br> + <h2>Useful Links</h2> + <li><a href="http://events.linuxfoundation.org/sites/events/files/slides/Functest%20in%20Depth_0.pdf">Functest in Depth</a></li> + <li><a href="https://git.opnfv.org/cgit/functest">Functest Repo</a></li> + <li><a href="https://wiki.opnfv.org/opnfv_functional_testing">Functest Project</a></li> + <li><a href="https://build.opnfv.org/ci/view/functest/">Functest Jenkins page</a></li> + <li><a href="https://jira.opnfv.org/secure/RapidBoard.jspa?rapidView=59&projectKey=FUNCTEST">JIRA</a></li> + + </div> + </div> + <div class="col-md-1"></div> +</div> diff --git a/utils/test/reporting/reporting-status.py b/utils/test/reporting/reporting-status.py new file mode 100644 index 000000000..b27af4b14 --- /dev/null +++ b/utils/test/reporting/reporting-status.py @@ -0,0 +1,178 @@ +from urllib2 import Request, urlopen, URLError +import urllib2 +import json +import jinja2 +import os +import random + + +class TestCase(object): + def __init__(self, name, project, criteria=-1): + self.name = name + self.project = project + self.criteria = criteria + + def getName(self): + return self.name + + def getProject(self): + return self.project + + def getCriteria(self): + return self.criteria + + def setCriteria(self, criteria): + self.criteria = criteria + + +def getApiResults(case, installer): + case = case.getName() + + # to remove proxy (to be removed at the end for local test only) + # proxy_handler = urllib2.ProxyHandler({}) + # opener = urllib2.build_opener(proxy_handler) + # urllib2.install_opener(opener) + url = "http://testresults.opnfv.org/testapi/results?case=" + case + "&period=30&installer=" + installer + #url = "http://127.0.0.1:8000/results?case=" + case + "&period=30&installer=" + installer + request = Request(url) + + try: + response = urlopen(request) + k = response.read() + results = json.loads(k) + except URLError, e: + print 'No kittez. Got an error code:', e + + return results + + +def getScenarios(case, installer): + + results = getApiResults(case, installer) + test_results = results['test_results'] + + if test_results is not None: + test_results.reverse() + + scenario_results = {} + + for r in test_results: + # Retrieve all the scenarios per installer + if not r['version'] in scenario_results.keys(): + scenario_results[r['version']] = [] + scenario_results[r['version']].append(r) + + return scenario_results + + +def getScenarioStats(scenario_results): + scenario_stats = {} + for k, v in scenario_results.iteritems(): + scenario_stats[k] = len(v) + + return scenario_stats + + +def getResult(testCase, installer): + + # retrieve raw results + results = getApiResults(testCase, installer) + # let's concentrate on test results only + test_results = results['test_results'] + + # if results found, analyze them + if test_results is not None: + test_results.reverse() + + scenario_results = {} + + for r in test_results: + if not r['version'] in scenario_results.keys(): + scenario_results[r['version']] = [] + scenario_results[r['version']].append(r) + + for s, s_result in scenario_results.items(): + scenario_results[s] = s_result[0:5] + # For each scenario, we build a result object to deal with + # results, criteria and error handling + for result in scenario_results[s]: + result["creation_date"] = result["creation_date"].split(".")[0] + + # Cannot be fully generic + # need to look for specific criteria case by case + # TODO add a criteria passed/failed in DB?? + # TODO result["Success_criteria"] = result["success_criteria"] + # meanwhile just random.... + # and consider the last random arbitrarily + # 4 levels for the results + # 3: 4+ consecutive runs passing the success criteria + # 2: <4 successful consecutive runs but passing the criteria + # 1: close to pass the success criteria + # 0: 0% success, not passing + # + + return int(random.random()*4)+1 + +# ****************************************************************************** +# ****************************************************************************** +# ****************************************************************************** +# ****************************************************************************** +# ****************************************************************************** + +# as the criteria are all difference, we shall use a common way to indicate +# the criteria +# 100 = 100% = all the test must be OK +# 90 = 90% = all the test must be above 90% of success rate +# TODO harmonize success criteria +# some criteria could be the duration, the success rate, the packet loss,... +# to be done case by case +# TODo create TestCriteria Object + + +installers = ["apex", "compass", "fuel", "joid"] +# init just tempest to get the scenario as all the scenarios run Temepst +tempest = TestCase("Tempest", "functest", -1) + +for installer in installers: + + scenario_results = getScenarios(tempest, installer) + scenario_stats = getScenarioStats(scenario_results) + + items = {} + + for s, s_result in scenario_results.items(): + + vPing = TestCase("vPing", "functest") + vPing_userdata = TestCase("vPing_userdata", "functest") + tempest = TestCase("Tempest", "functest") + rally = TestCase("Rally", "functest") + odl = TestCase("ODL", "functest") + onos = TestCase("ONOS", "functest") + ovno = TestCase("OVNO", "functest") + vIMS = TestCase("vIMS", "functest") + doctor = TestCase("doctor-notification", "doctor") + promise = TestCase("promise", "promise") + odl_vpn = TestCase("ODL VPN Service tests", "sdnvpn") + bgpvpn_api = TestCase("OpenStack Neutron BGPVPN API extension tests", + "sdnvpn") + testCases = [vPing, vPing_userdata, tempest, rally, odl, onos, vIMS, + doctor, promise] + + for testCase in testCases: + result = getResult(testCase, installer) + testCase.setCriteria(result) + # print "case %s (%s) = %s " % (testCase.getName(), s, result) + items[s] = testCases + + templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__))) + templateEnv = jinja2.Environment(loader=templateLoader) + + TEMPLATE_FILE = "index-status-tmpl.html" + template = templateEnv.get_template(TEMPLATE_FILE) + + outputText = template.render(scenario_stats=scenario_stats, + items=items, + installer=installer) + + with open("index-status-" + installer + ".html", "wb") as fh: + fh.write(outputText) diff --git a/utils/test/reporting/reporting-tempest.py b/utils/test/reporting/reporting-tempest.py new file mode 100644 index 000000000..944b42809 --- /dev/null +++ b/utils/test/reporting/reporting-tempest.py @@ -0,0 +1,99 @@ +from urllib2 import Request, urlopen, URLError +import json +import jinja2 +import os + +installers = ["apex", "compass", "fuel", "joid"] +items = ["tests", "Success rate", "duration"] + +for installer in installers: + # we consider the Tempest results of the last 7 days + url = "http://testresults.opnfv.org/testapi/results?case=Tempest" + request = Request(url + '&period=7&installer=' + installer) + + try: + response = urlopen(request) + k = response.read() + results = json.loads(k) + except URLError, e: + print 'No kittez. Got an error code:', e + + test_results = results['test_results'] + test_results.reverse() + + scenario_results = {} + criteria = {} + errors = {} + + for r in test_results: + # Retrieve all the scenarios per installer + if not r['version'] in scenario_results.keys(): + scenario_results[r['version']] = [] + scenario_results[r['version']].append(r) + + for s, s_result in scenario_results.items(): + scenario_results[s] = s_result[0:5] + # For each scenario, we build a result object to deal with + # results, criteria and error handling + for result in scenario_results[s]: + result["creation_date"] = result["creation_date"].split(".")[0] + + # retrieve results + # **************** + nb_tests_run = result['details']['tests'] + if nb_tests_run != 0: + success_rate = 100*(int(result['details']['tests']) - int(result['details']['failures']))/int(result['details']['tests']) + else: + success_rate = 0 + + result['details']["tests"] = nb_tests_run + result['details']["Success rate"] = str(success_rate) + "%" + + # Criteria management + # ******************* + crit_tests = False + crit_rate = False + crit_time = False + + # Expect that at least 200 tests are run + if nb_tests_run >= 200: + crit_tests = True + + # Expect that at least 90% of success + if success_rate >= 90: + crit_rate = True + + # Expect that the suite duration is inferior to 45m + if result['details']['duration'] < 2700: + crit_time = True + + result['criteria'] = {'tests': crit_tests, + 'Success rate': crit_rate, + 'duration': crit_time} + + # error management + # **************** + + # TODO get information from artefact based on build tag + # to identify errors of the associated run + # build tag needed to wget errors on the artifacts + # the idea is to list the tests in errors and provide the link + # towards complete artifact + # another option will be to put the errors in the DB + # (in the detail section)... + result['errors'] = {'tests': "", + 'Success rate': "", + 'duration': ""} + + templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__))) + templateEnv = jinja2.Environment(loader=templateLoader) + + TEMPLATE_FILE = "index-tempest-tmpl.html" + template = templateEnv.get_template(TEMPLATE_FILE) + + outputText = template.render(scenario_results=scenario_results, + items=items, + installer=installer) + + with open("index-tempest-" + installer + ".html", "wb") as fh: + fh.write(outputText) diff --git a/utils/test/result_collection_api/tools/reporting/reporting.py b/utils/test/reporting/reporting-vims.py index 246c6250c..cf43f3ebc 100644 --- a/utils/test/result_collection_api/tools/reporting/reporting.py +++ b/utils/test/reporting/reporting-vims.py @@ -47,7 +47,7 @@ for installer in installers: for result in scenario_results[s]: result["creation_date"] = result["creation_date"].split(".")[0] sig_test = result['details']['sig_test']['result'] - if not sig_test == "": + if not sig_test == "" and isinstance(sig_test, list): format_result = sig_test_format(sig_test) if format_result['failures'] > format_result['passed']: result['details']['sig_test']['duration'] = 0 @@ -72,12 +72,12 @@ for installer in installers: templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__))) templateEnv = jinja2.Environment( loader=templateLoader ) - TEMPLATE_FILE = "index-tmpl.html" + TEMPLATE_FILE = "index-vims-tmpl.html" template = templateEnv.get_template( TEMPLATE_FILE ) outputText = template.render( scenario_results = scenario_results, step_order = step_order, installer = installer) - with open("index-" + installer + ".html", "wb") as fh: + with open("index-vims" + installer + ".html", "wb") as fh: fh.write(outputText) diff --git a/utils/test/result_collection_api/resources/handlers.py b/utils/test/result_collection_api/resources/handlers.py index 1f4d0bb7b..1eda3b067 100644 --- a/utils/test/result_collection_api/resources/handlers.py +++ b/utils/test/result_collection_api/resources/handlers.py @@ -510,6 +510,8 @@ class TestResultsHandler(GenericApiHandler): - installer (fuel, ...) - build_tag : Jenkins build tag name - period : x (x last days) + - scenario : the test scenario (previously version) + - criteria : the global criteria status passed or failed :param result_id: Get a result by ID @@ -526,6 +528,8 @@ class TestResultsHandler(GenericApiHandler): version_arg = self.get_query_argument("version", None) installer_arg = self.get_query_argument("installer", None) build_tag_arg = self.get_query_argument("build_tag", None) + scenario_arg = self.get_query_argument("scenario", None) + criteria_arg = self.get_query_argument("criteria", None) period_arg = self.get_query_argument("period", None) # prepare request @@ -549,6 +553,12 @@ class TestResultsHandler(GenericApiHandler): if build_tag_arg is not None: get_request["build_tag"] = build_tag_arg + if scenario_arg is not None: + get_request["scenario"] = scenario_arg + + if criteria_arg is not None: + get_request["criteria_tag"] = criteria_arg + if period_arg is not None: try: period_arg = int(period_arg) diff --git a/utils/test/result_collection_api/resources/models.py b/utils/test/result_collection_api/resources/models.py index 6f9386208..35b6af11f 100644 --- a/utils/test/result_collection_api/resources/models.py +++ b/utils/test/result_collection_api/resources/models.py @@ -151,6 +151,8 @@ class TestResult: self.creation_date = None
self.details = None
self.build_tag = None
+ self.scenario = None
+ self.criteria = None
@staticmethod
def test_result_from_dict(test_result_dict):
@@ -169,6 +171,8 @@ class TestResult: t.version = test_result_dict.get('version')
t.installer = test_result_dict.get('installer')
t.build_tag = test_result_dict.get('build_tag')
+ t.scenario = test_result_dict.get('scenario')
+ t.criteria = test_result_dict.get('criteria')
return t
@@ -182,7 +186,9 @@ class TestResult: "version": self.version,
"installer": self.installer,
"details": self.details,
- "build_tag": self.build_tag
+ "build_tag": self.build_tag,
+ "scenario": self.scenario,
+ "criteria": self.criteria
}
def format_http(self):
@@ -196,6 +202,8 @@ class TestResult: "version": self.version,
"installer": self.installer,
"details": self.details,
- "build_tag": self.build_tag
+ "build_tag": self.build_tag,
+ "scenario": self.scenario,
+ "criteria": self.criteria
}
diff --git a/utils/test/result_collection_api/tools/samples/sample.json.postman_collection b/utils/test/result_collection_api/samples/sample.json.postman_collection index 9ee35d15e..9ee35d15e 100644 --- a/utils/test/result_collection_api/tools/samples/sample.json.postman_collection +++ b/utils/test/result_collection_api/samples/sample.json.postman_collection diff --git a/utils/test/result_collection_api/tools/backup-db.sh b/utils/test/scripts/backup-db.sh index aa36aa370..aa36aa370 100644 --- a/utils/test/result_collection_api/tools/backup-db.sh +++ b/utils/test/scripts/backup-db.sh |