X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Ftest%2Freporting%2Ffunctest%2FreportingUtils.py;h=9ba02e82154a588408bd258b9fbcda4287619a1e;hb=8ee93eea567ee83d67232ebf22cd0f2a9439c5d6;hp=5051ffa95dc814b6a6fbd65d5401228dd4933562;hpb=7a15fe87e945549232a804e2984561dd772258ef;p=releng.git diff --git a/utils/test/reporting/functest/reportingUtils.py b/utils/test/reporting/functest/reportingUtils.py index 5051ffa95..9ba02e821 100644 --- a/utils/test/reporting/functest/reportingUtils.py +++ b/utils/test/reporting/functest/reportingUtils.py @@ -37,7 +37,7 @@ def getApiResults(case, installer, scenario, version): # urllib2.install_opener(opener) # url = "http://127.0.0.1:8000/results?case=" + case + \ # "&period=30&installer=" + installer - url = (conf.URL_BASE + "?case=" + case + + url = ("http://" + conf.URL_BASE + "?case=" + case + "&period=" + str(conf.PERIOD) + "&installer=" + installer + "&scenario=" + scenario + "&version=" + version + "&last=" + str(conf.NB_TESTS)) @@ -56,7 +56,7 @@ def getApiResults(case, installer, scenario, version): def getScenarios(case, installer, version): case = case.getName() - url = (conf.URL_BASE + "?case=" + case + + url = ("http://" + conf.URL_BASE + "?case=" + case + "&period=" + str(conf.PERIOD) + "&installer=" + installer + "&version=" + version) request = Request(url) @@ -139,7 +139,7 @@ def getResult(testCase, installer, scenario, version): # print "Nb test OK (last 10 days):"+ str(nbTestOk) # check that we have at least 4 runs if len(scenario_results) < 1: - # No results available + # No results available test_result_indicator = -1 elif nbTestOk < 1: test_result_indicator = 0 @@ -158,3 +158,21 @@ def getResult(testCase, installer, scenario, version): else: test_result_indicator = 2 return test_result_indicator + + +def getJenkinsUrl(build_tag): + # e.g. jenkins-functest-apex-apex-daily-colorado-daily-colorado-246 + # id = 246 + # note it is linked to jenkins format + # if this format changes...function to be adapted.... + url_base = "https://build.opnfv.org/ci/view/functest/job/" + jenkins_url = "" + try: + build_id = [int(s) for s in build_tag.split("-") if s.isdigit()] + jenkins_path = filter(lambda c: not c.isdigit(), build_tag) + url_id = jenkins_path[8:-1] + "/" + str(build_id[0]) + jenkins_url = url_base + url_id + "/console" + except: + print 'Impossible to get jenkins url:' + + return jenkins_url