browse.cgi changes done Diff comments:
> diff --git a/charms/focal/autopkgtest-web/webcontrol/browse.cgi > b/charms/focal/autopkgtest-web/webcontrol/browse.cgi > index 7355d6b..4437be8 100755 > --- a/charms/focal/autopkgtest-web/webcontrol/browse.cgi > +++ b/charms/focal/autopkgtest-web/webcontrol/browse.cgi > @@ -452,6 +457,100 @@ def testlist(): > return render("browse-testlist.html", indexed_pkgs=indexed_pkgs) > > > +@app.route("/post-integration-results", methods=["POST"]) > +def handle_results(): > + # need to check authentication using password or something > + global INTEGRATION_TEST_RES_FP > + results = {} > + if os.path.isfile(INTEGRATION_TEST_RES_FP): > + with open(INTEGRATION_TEST_RES_FP, "r") as f: > + results = json.load(f) > + data = request.json > + > + # key check > + keys = ["type", "source", "pass", "test", "results"] > + # make this check more extensive ? done > + for k in keys: > + if k not in data.keys(): > + return > + if data["type"] not in ["cloud", "web"]: > + return > + # authenticate here > + keypass = "" > + if os.path.isfile(INTEGRATION_TESTS_PASS_FP): > + with open(INTEGRATION_TESTS_PASS_FP, "r") as f: > + keypass = f.read() > + if data["pass"].rstrip() != keypass.rstrip(): > + return ( > + json.dumps({"success": False, "reason": "incorrect pass"}), > + 403, > + {"ContentType": "application/json"}, > + ) > + > + if "cloud" not in results.keys(): > + results["cloud"] = {} > + if "web" not in results.keys(): > + results["web"] = {} > + if data["source"] not in results[data["type"]].keys(): > + results[data["type"]][data["source"]] = {} > + results[data["type"]][data["source"]][data["test"]] = data["results"] > + with open(INTEGRATION_TEST_RES_FP, "w") as f: > + json.dump(results, f, indent=2) > + return ( > + json.dumps({"success": True}), > + 200, > + {"ContentType": "application/json"}, > + ) > + > + # results being posted > + # results = { > + # "type": "cloud/web", > + # "source": "machine-name", > + # "pass": "pass", > + # "test": "config-files/endpoints/test-run-autopkgtest", > + # "results": {}, # <- json of actual test results > + # } > + > + # results going out: > + # results = { > + # "cloud": { > + # "machine1": { > + # "test-name-1": {}, # <- results > + # "test-name-2": {}, # <- results > + # }, > + # "machine2": { > + # "test-name-1": {}, # <- results > + # "test-name-2": {}, # <- results > + # } > + # }, > + # "web" : { > + # "machine1": { > + # "test-name-1": {}, # <- results > + # "test-name-2": {}, # <- results > + # }, > + # "machine1": { > + # "test-name-1": {}, # <- results > + # "test-name-2": {}, # <- results > + # }, > + # } > + # } > + > + > +@app.route("/integration-test-results.json", methods=["GET"]) > +def get_integration_test_results(): > + global INTEGRATION_TEST_RES_FP > + results = {} > + if os.path.isfile(INTEGRATION_TEST_RES_FP): > + with open(INTEGRATION_TEST_RES_FP, "r") as f: > + results = json.load(f) > + return flask.Response( > + json.dumps(results, indent=2), mimetype="application/json" > + ) > + return flask.Response( > + json.dumps({}, indent=2), mimetype="application/json" > + ) > + > + > @app.route("/statistics") > def statistics(): > release_arches = get_release_arches() -- https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/457239 Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:integration-tests into autopkgtest-cloud:master. -- Mailing list: https://launchpad.net/~canonical-ubuntu-qa Post to : canonical-ubuntu-qa@lists.launchpad.net Unsubscribe : https://launchpad.net/~canonical-ubuntu-qa More help : https://help.launchpad.net/ListHelp