aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gui.py4
-rw-r--r--tests/test_remote.py12
2 files changed, 15 insertions, 1 deletions
diff --git a/tests/test_gui.py b/tests/test_gui.py
index d77df20..4eb4211 100644
--- a/tests/test_gui.py
+++ b/tests/test_gui.py
@@ -291,7 +291,8 @@ class SmokeTest(unittest.TestCase):
"stats": (STATS, None), "jobs": ({"jobs": []}, None),
"gpg-status": ({"unlocked": True, "key": "K"}, None),
"inventory": (INVENTORY, None), "results": (RESULTS, None),
- "build-log": ({"build": "\x1b[1mERROR\x1b[0m: make failed\n",
+ "build-log": ({"name": "update.log",
+ "build": "\x1b[1mERROR\x1b[0m: make failed\n",
"truncated": True, "mtime": 0,
"resource": "peak memory 3308M\n"}, None),
**answers})
@@ -483,6 +484,7 @@ class SmokeTest(unittest.TestCase):
self.assertIn("peak memory", viewer.text.toPlainText())
self.assertIn("truncated", viewer.text.toPlainText())
self.assertTrue(viewer.text.toPlainText().endswith("make failed\n")) # failure stays last
+ self.assertIn("update.log", viewer.windowTitle())
viewer.close()
def test_dashboard_results_clicks(self):
diff --git a/tests/test_remote.py b/tests/test_remote.py
index 85e642b..db3d0a1 100644
--- a/tests/test_remote.py
+++ b/tests/test_remote.py
@@ -489,8 +489,20 @@ class ResultsTest(Base):
self.assertEqual(log["build"], "\nERROR: make failed\n"[-20:])
self.assertTrue(log["truncated"])
self.assertEqual(log["resource"], "peak memory 3308M\n")
+ self.assertEqual(log["name"], "build.log")
self.assertIsInstance(log["mtime"], int)
+ def test_newest_command_log_wins(self):
+ # slackrepo keeps one log per command: the last attempt may be an update
+ d = os.path.join(self.cfg["slackrepo_logdir"], "cat", "c")
+ os.utime(os.path.join(d, "build.log"), (1000, 1000))
+ with open(os.path.join(d, "update.log"), "w") as f:
+ f.write("ERROR: Download failed\n")
+ with open(os.path.join(d, "config.log"), "w") as f:
+ f.write("autotools noise\n")
+ log = sbb.cmd_build_log(self.cfg, "cat/c")
+ self.assertEqual((log["name"], log["build"]), ("update.log", "ERROR: Download failed\n"))
+
def test_build_log_rejects(self):
for bad in ("../etc/passwd", "cat/../../x", "cat", "cat/a", "/etc/x"):
with self.subTest(bad=bad), self.assertRaises(sbb.Error):