Merge ppa-dev-tools:support-subtest-status-flaky into ppa-dev-tools:main

Proposed by Bryce Harrington
Status: Needs review
Proposed branch: ppa-dev-tools:support-subtest-status-flaky
Merge into: ppa-dev-tools:main
Diff against target: 115 lines (+21/-11)
4 files modified
ppa/result.py (+1/-1)
ppa/subtest.py (+2/-0)
tests/test_result.py (+9/-3)
tests/test_subtest.py (+9/-7)
Reviewer Review Type Date Requested Status
Athos Ribeiro (community) Approve
Canonical Server Reporter Pending
Review via email: mp+465631@code.launchpad.net

Description of the change

autopkgtest subtests can be given the restriction 'flaky'[1][2], which results in the subtest being given the status 'FLAKY' in the test log[3]. This is not common and fairly unexciting, but it does show up in the wild[4].

1: https://people.debian.org/~eriberto/README.package-tests.html
2: https://git.launchpad.net/ubuntu/+source/rust-clang-sys/tree/debian/tests/control
3: https://autopkgtest.ubuntu.com/results/autopkgtest-oracular/oracular/ppc64el/r/rust-clang-sys/20240506_050646_5005b@/log.gz
4: https://autopkgtest.ubuntu.com/packages/r/rust-clang-sys/oracular/ppc64el

I display the subtests with colored squares from the unicode characters, and unfortunately there are only a handful of colors available. I considered purple, but brown felt like a better conceptual fit, and purple seemed like it could be useful for some other situation.

To post a comment you must log in.
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

LGTM. I am not sure how the contrast between this brown and the yellow/red colors we already use will be seen by users though, but I have no better suggestions here!

review: Approve

Unmerged commits

45c013f... by Bryce Harrington

Add support for subtests marked as 'FLAKY'

Subtest icons will be brown, like a flaky chocolate pastry.

Fixes: https://bugs.launchpad.net/ppa-dev-tools/+bug/1989650

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/ppa/result.py b/ppa/result.py
2index 7488f54..5d6f25f 100755
3--- a/ppa/result.py
4+++ b/ppa/result.py
5@@ -205,7 +205,7 @@ class Result:
6
7 subtests = []
8 result_sum = result_split[1]
9- for line in re.findall("(.*PASS|.*SKIP|.*FAIL|.*BAD)", result_sum):
10+ for line in re.findall("(.*PASS|.*SKIP|.*FAIL|.*FLAKY|.*BAD)", result_sum):
11 if re.match(r"^[0-9]+s\s", line):
12 # Newer autopkgtest logs are prefixed with the timestamp. Ignore it.
13 line = line.split(' ', 1)[1]
14diff --git a/ppa/subtest.py b/ppa/subtest.py
15index 624334f..da3cdb1 100755
16--- a/ppa/subtest.py
17+++ b/ppa/subtest.py
18@@ -26,6 +26,7 @@ class Subtest:
19 'PASS': "🟩",
20 'SKIP': "🟧",
21 'FAIL': "🟥",
22+ 'FLAKY': "🟫",
23 'BAD': "⛔",
24 'UNKNOWN': "⚪"
25 }
26@@ -116,6 +117,7 @@ if __name__ == "__main__":
27 print(Subtest('subtest-e SKIP'))
28 print(Subtest('subtest-f BAD'))
29 print(Subtest('librust-clang-sys-dev:clang_10_0 FAIL non-zero exit status 101'))
30+ print(Subtest('librust-clang-sys-dev:static FLAKY non-zero exit status 101'))
31 print()
32
33 print("Invalid cases")
34diff --git a/tests/test_result.py b/tests/test_result.py
35index 89a6c8f..3c758cc 100644
36--- a/tests/test_result.py
37+++ b/tests/test_result.py
38@@ -85,13 +85,14 @@ def test_str():
39 (
40 # When at least one Subtest fails, all subtest results should be shown.
41 '20030201_040506',
42- [Subtest('x PASS'), Subtest('y FAIL'), Subtest('z SKIP')],
43+ [Subtest('x PASS'), Subtest('y FAIL'), Subtest('f FLAKY'), Subtest('z SKIP')],
44 True,
45 """ + ❌ source on series for arch @ 01.02.03 04:05:06
46 • Log: file://<DATA_DIR>/x
47 • Status: FAIL
48 • x PASS 🟩
49 • y FAIL 🟥
50+ • f FLAKY 🟫
51 • z SKIP 🟧
52 """
53 ),
54@@ -177,10 +178,11 @@ def test_get_triggers(monkeypatch, triggers, name, expected):
55 "x: @@@@@@@@@@@@@@@@@@@@ summary\n"
56 "test-a PASS\n"
57 "test-b FAIL ignorable-note\n"
58- "test-c NoTaVaLiDsTaTuS\n"
59+ "test-c FLAKY some-detail\n"
60+ "test-d NoTaVaLiDsTaTuS\n"
61 ),
62 None,
63- {'test-a': 'PASS', 'test-b': 'FAIL'}
64+ {'test-a': 'PASS', 'test-b': 'FAIL', 'test-c': 'FLAKY'}
65 ),
66 (
67 (
68@@ -254,9 +256,13 @@ def test_get_subtests(tmp_path, log_text: str, subtest_name: str, expected: dict
69 ([], None, 'PASS'),
70 (['PASS'], None, 'PASS'),
71 (['FAIL'], None, 'FAIL'),
72+ (['SKIP'], None, 'PASS'),
73+ (['FLAKY'], None, 'PASS'),
74 (['PASS', 'FAIL'], None, 'FAIL'),
75 (['FAIL', 'PASS'], None, 'FAIL'),
76 (['PASS', 'PASS', 'PASS'], None, 'PASS'),
77+ (['PASS', 'FLAKY'], None, 'PASS'),
78+ (['PASS', 'SKIP'], None, 'PASS'),
79 (['PASS'], 'x', 'BAD'),
80 (['FAIL'], 'x', 'BAD'),
81 ])
82diff --git a/tests/test_subtest.py b/tests/test_subtest.py
83index 41ac536..e7b3327 100644
84--- a/tests/test_subtest.py
85+++ b/tests/test_subtest.py
86@@ -87,6 +87,7 @@ def test_desc():
87 ('c FAIL', 'FAIL'),
88 ('d FAIL non-zero exit status 123', 'FAIL'),
89 ('librust-clang-sys-dev:clang_10_0 FAIL non-zero exit status 101', 'FAIL'),
90+ ('librust-clang-sys-dev:static FLAKY non-zero exit status 101', 'FLAKY'),
91 ('f BAD', 'BAD'),
92 ('g UNKNOWN', 'UNKNOWN'),
93 ('h invalid', 'UNKNOWN'),
94@@ -101,13 +102,14 @@ def test_status(line, status):
95
96
97 @pytest.mark.parametrize('line, icon', [
98- ('a PASS', "🟩"),
99- ('b SKIP', "🟧"),
100- ('c FAIL', "🟥"),
101- ('d BAD', "⛔"),
102- ('e UNKNOWN', "⚪"),
103- ('f invalid', "⚪"),
104- ('f bAd', "⚪"),
105+ ('x PASS', "🟩"),
106+ ('x SKIP', "🟧"),
107+ ('x FAIL', "🟥"),
108+ ('x FLAKY', "🟫"),
109+ ('x BAD', "⛔"),
110+ ('x UNKNOWN', "⚪"),
111+ ('x invalid', "⚪"),
112+ ('x bAd', "⚪"),
113 ])
114 def test_status_icon(line, icon):
115 """Checks Subtest provides correct icon for status.

Subscribers

People subscribed via source and target branches

to all changes: