Merge ~tushar5526/lpbuildbot:add-debug-logs into lpbuildbot:main

Proposed by Tushar Gupta
Status: Rejected
Rejected by: Tushar Gupta
Proposed branch: ~tushar5526/lpbuildbot:add-debug-logs
Merge into: lpbuildbot:main
Diff against target: 85 lines (+21/-1)
1 file modified
lpbuildbot/subunittest.py (+21/-1)
Reviewer Review Type Date Requested Status
Canonical Launchpad Engineering Pending
Review via email: mp+499934@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Tushar Gupta (tushar5526) wrote :

No longer needed. It was a one off issue.

Unmerged commits

e172eb1... by Tushar Gupta

Add debug logs to track the failing build runs on lp-db-devel-focal.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lpbuildbot/subunittest.py b/lpbuildbot/subunittest.py
2index 41d7b6d..e8e4971 100644
3--- a/lpbuildbot/subunittest.py
4+++ b/lpbuildbot/subunittest.py
5@@ -89,12 +89,14 @@ class SubunitObserver(testtools.TestResult):
6 testtools.TestResult.time(self, test)
7
8 def startTest(self, test):
9+ print(f"DEBUG startTest: {test.id()}")
10 if 'summary' not in self.logs:
11 self.logs['summary'] = self.step.addLog('summary')
12 self.started = True
13 testtools.TestResult.startTest(self, test)
14
15 def stopTest(self, test):
16+ print(f"DEBUG stopTest: {test.id()}")
17 if ('zope:layer' not in self.current_tags and
18 'zope:info_suboptimal' not in self.current_tags):
19 worker_id = self.current_worker_id()
20@@ -110,24 +112,30 @@ class SubunitObserver(testtools.TestResult):
21 self.logs[name] = self.step.addLog(name)
22 self.log(worker_id, test.id())
23 self.real_test_count += 1
24+ print(f"DEBUG: Test count incremented to {self.real_test_count}")
25 self.step.setProgress('tests', self.real_test_count)
26 self.step.step_status.setStatistic(
27 'tests-total', self.real_test_count)
28+ print(f"DEBUG: Set statistic tests-total={self.real_test_count}")
29 testtools.TestResult.stopTest(self, test)
30 self.step.step_status.setText(self.step.describe(False))
31
32 def addError(self, test, err):
33+ print(f"DEBUG addError: {test.id()}")
34 testtools.TestResult.addError(self, test, err)
35 self.log(
36 'summary', self.format_error('ERROR', test.id(), str(err[1])))
37 self.error_count += 1
38+ print(f"DEBUG: Error count incremented to {self.error_count}")
39 self.step.step_status.setStatistic('tests-errors', self.error_count)
40
41 def addFailure(self, test, err):
42+ print(f"DEBUG addFailure: {test.id()}")
43 testtools.TestResult.addFailure(self, test, err)
44 self.log(
45 'summary', self.format_error('FAILURE', test.id(), str(err[1])))
46 self.failure_count += 1
47+ print(f"DEBUG: Failure count incremented to {self.failure_count}")
48 self.step.step_status.setStatistic(
49 'tests-failures', self.failure_count)
50
51@@ -135,15 +143,24 @@ class SubunitObserver(testtools.TestResult):
52
53
54 def describe(step_status, base_description=None, done=False):
55+ print(f"DEBUG describe: called with done={done}")
56+
57 if base_description is None:
58 description = []
59 else:
60 description = base_description[:]
61- if step_status.hasStatistic('tests-total'):
62+
63+ has_stats = step_status.hasStatistic('tests-total')
64+ print(f"DEBUG describe: hasStatistic('tests-total')={has_stats}")
65+
66+ if has_stats:
67 total = step_status.getStatistic("tests-total", 0)
68 failures = step_status.getStatistic("tests-failures", 0)
69 errors = step_status.getStatistic("tests-errors", 0)
70 passed = total - (failures + errors)
71+
72+ print(f"DEBUG describe: total={total}, failures={failures}, "
73+ f"errors={errors}, passed={passed}")
74
75 if total:
76 description.append('%d tests' % total)
77@@ -156,7 +173,10 @@ def describe(step_status, base_description=None, done=False):
78 if not done:
79 description.append('(still running)')
80 else:
81+ print("DEBUG describe: No statistics found, returning 'no test results'")
82 description.append('no test results')
83+
84+ print(f"DEBUG describe: returning {description}")
85 return description
86
87

Subscribers

People subscribed via source and target branches