Skip to content

Commit

Permalink
tests-invoke: add the scenario to the title
Browse files Browse the repository at this point in the history
We create an issue per test scenario, adding the scenario to the title
makes it easier to spot the difference.
  • Loading branch information
jelly authored and martinpitt committed Sep 8, 2023
1 parent 8b6d194 commit 1138246
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions task/test-tests-scan
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ class TestTestsScan(unittest.TestCase):
fp.write("#!/bin/bash\nexit 1")
os.system(f"chmod +x {testdir}/run")
proc = subprocess.Popen([script, *args], stdout=subprocess.PIPE, universal_newlines=True,
env={"GITHUB_API": f"http://{ADDRESS[0]}:{ADDRESS[1]}", "TEST_INVOKE_SLEEP": "1"},
env={"GITHUB_API": f"http://{ADDRESS[0]}:{ADDRESS[1]}",
"TEST_INVOKE_SLEEP": "1", "TEST_OS": "fedora-38"},
cwd=tempdir)
output, stderr = proc.communicate()
api = github.GitHub(f"http://{ADDRESS[0]}:{ADDRESS[1]}/")
Expand All @@ -240,7 +241,7 @@ class TestTestsScan(unittest.TestCase):
self.assertEqual(output, "")
self.assertEqual(proc.returncode, 1)
self.assertEqual(len(issues), 1)
self.assertEqual(issues[0]['title'], "Nightly tests did not succeed")
self.assertEqual(issues[0]['title'], "Nightly tests did not succeed on fedora-38")
self.assertEqual(issues[0]['body'], f"Tests failed on {self.revision}")
self.assertEqual(issues[0]['labels'], ["nightly"])
self.assertIsNone(stderr)
Expand Down
7 changes: 6 additions & 1 deletion tests-invoke
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ def main():
return_code = p.returncode
sys.stderr.write("Test run finished, return code: {0}\n".format(return_code))
if not api.has_open_prs(opts.revision) and return_code != 0:
test_scenario = os.getenv("TEST_SCENARIO", "")
test_os = os.getenv("TEST_OS")
title = f"Nightly tests did not succeed on {test_os}"
if test_scenario != "":
title += f"/{test_scenario}"
data = {
"title": "Nightly tests did not succeed",
"title": title,
"body": f"Tests failed on {opts.revision}",
"labels": ["nightly"]
}
Expand Down

0 comments on commit 1138246

Please sign in to comment.