canonical-ubuntu-qa team mailing list archive
-
canonical-ubuntu-qa team
-
Mailing list archive
-
Message #01607
[Merge] ~andersson123/autopkgtest-cloud:fix_duplicate_git_req into autopkgtest-cloud:master
Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:fix_duplicate_git_req into autopkgtest-cloud:master.
Requested reviews:
Canonical's Ubuntu QA (canonical-ubuntu-qa)
For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/453063
--
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:fix_duplicate_git_req into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/submit.py b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
index 94ad34b..837d67e 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/submit.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
@@ -559,7 +559,14 @@ class Submit:
return (code, response)
def is_test_running(
- self, req_series, req_arch, req_package, req_triggers, kwargs, git
+ self,
+ req_series,
+ req_arch,
+ req_package,
+ req_triggers,
+ kwargs,
+ ppas,
+ git,
):
if not os.path.isfile(RUNNING_FP):
return False
@@ -567,6 +574,8 @@ class Submit:
with open(RUNNING_FP, "r") as f:
data = json.load(f)
for pkg in data:
+ if pkg != req_package:
+ continue
for submitted in data[pkg]:
releases = data[pkg][submitted].keys()
for release in data[pkg][submitted]:
@@ -578,20 +587,20 @@ class Submit:
running_all_proposed = "all-proposed_1" in submitted
req_all_proposed = "all-proposed" in kwargs.keys()
git_same = False
- if git:
+ if git and "build-git" in submitted:
build_git_url = data[pkg][submitted][release][
arch
][0].get("build-git", [])
- ppas = data[pkg][submitted][release][arch][0].get(
- "ppas", []
- )
+ ppas_running = data[pkg][submitted][release][arch][
+ 0
+ ].get("ppas", [])
env = data[pkg][submitted][release][arch][0].get(
"env", []
)
if (
- kwargs["build-git"] == build_git_url
- and ppas == kwargs["ppa"]
- and (set(kwargs["env"]) == set(env))
+ kwargs.get("build-git", "") == build_git_url
+ and ppas_running == ppas
+ and (set(kwargs.get("env", [])) == set(env))
):
git_same = True
if (
@@ -606,7 +615,14 @@ class Submit:
return False
def is_test_in_queue(
- self, req_series, req_arch, req_package, req_triggers, kwargs, git
+ self,
+ req_series,
+ req_arch,
+ req_package,
+ req_triggers,
+ kwargs,
+ ppas,
+ git,
):
if not os.path.isfile(QUEUE_FP):
return False
@@ -624,6 +640,8 @@ class Submit:
for release in data[test_type]:
for arch in data[test_type][release]:
packages = data[test_type][release][arch]
+ if req_package not in packages:
+ continue
if packages["size"] != 0:
for req in packages["requests"]:
pkg = req[: req.find("{")].rstrip()
@@ -644,14 +662,17 @@ class Submit:
"triggers": sorted(triggers),
}
git_same = False
- if git:
+ if git and "build-git" in details:
build_git_url = details.get("build-git", [])
- ppas = details.get("ppas", [])
+ ppas_queued = details.get("ppas", [])
env = details.get("env", [])
if (
- kwargs["build-git"] == build_git_url
- and ppas == kwargs["ppa"]
- and (set(kwargs["env"]) == set(env))
+ kwargs.get("build-git", "")
+ == build_git_url
+ and ppas_queued == ppas
+ and (
+ set(kwargs.get("env", [])) == set(env)
+ )
):
git_same = True
if (
@@ -669,17 +690,18 @@ class Submit:
req_package,
req_triggers=[],
kwargs={},
+ ppas=[],
git=False,
):
if self.is_test_running(
- req_series, req_arch, req_package, req_triggers, kwargs, git
+ req_series, req_arch, req_package, req_triggers, kwargs, ppas, git
):
raise RequestRunning(
req_series, req_package, req_arch, req_triggers
)
if self.is_test_in_queue(
- req_series, req_arch, req_package, req_triggers, kwargs, git
+ req_series, req_arch, req_package, req_triggers, kwargs, ppas, git
):
raise RequestInQueue(
req_series, req_package, req_arch, req_triggers
Follow ups