Skip to content

Commit 7ef88e8

Browse files
ptoscanomartinpitt
authored andcommitted
test: add --track-naughties option for run-tests
Reporting/updating the status of naughties requires proper permissions (e.g. a GitHub token to update comments of Cockpituous), which is not something common outside of the cockpit project members. Also, local runs ought to not change the status of naughties, as the runs may be local testing. Hence, slightly change the default behaviour of run-tests to not update the status of naughties anymore; introduce a new --track-naughties that restores the old behaviour, and which will need to be used in CI invocations of run-tests. Use --track-naughties in existing run-tests invocation, to retain the old behaviour.
1 parent daafb5f commit 7ef88e8

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

test/common/run-tests

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Test:
7373

7474
return poll_result
7575

76-
def finish(self, affected_tests, print_tap=True, thorough=False):
76+
def finish(self, affected_tests, print_tap=True, thorough=False, track_naughties=False):
7777
"""Returns if a test should retry or not
7878
7979
Call test-failure-policy on the test's output, print if needed.
@@ -103,7 +103,10 @@ class Test:
103103
return None, 0
104104

105105
if not thorough:
106-
cmd = ["test-failure-policy", testvm.DEFAULT_IMAGE]
106+
cmd = ["test-failure-policy"]
107+
if not track_naughties:
108+
cmd.append("--offline")
109+
cmd.append(testvm.DEFAULT_IMAGE)
107110
try:
108111
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
109112
reason = proc.communicate(self.output + ("not ok " + str(self)).encode())[0].strip()
@@ -374,7 +377,7 @@ def run(opts, image):
374377
made_progress = True
375378
running_tests.remove(test)
376379
test_machine = test.machine_id # test_finish() resets it
377-
retry_reason, test_result = test.finish(changed_tests, print_tap=not opts.list, thorough=opts.thorough)
380+
retry_reason, test_result = test.finish(changed_tests, print_tap=not opts.list, thorough=opts.thorough, track_naughties=opts.track_naughties)
378381
fail_count += test_result
379382
logging.debug(f"test {test} finished; result {test_result} retry reason {retry_reason}")
380383

@@ -493,6 +496,8 @@ def main():
493496
help="RAM size for nondestructive test global machines")
494497
parser.add_argument('--base', default=os.environ.get("BASE_BRANCH"),
495498
help="Retry affected tests compared to given base branch; default: %(default)s")
499+
parser.add_argument('--track-naughties', action='store_true',
500+
help='Update the occurrence of naughties on cockpit-project/bots')
496501
opts = parser.parse_args()
497502

498503
if opts.machine:

test/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ TEST_SCENARIO=${TEST_SCENARIO:-verify}
1212

1313
case $TEST_SCENARIO in
1414
verify|devel|firefox|firefox-devel)
15-
OPTS=""
15+
OPTS="--track-naughties"
1616
[ "${TEST_SCENARIO}" = "${TEST_SCENARIO%%devel}" ] || export NODE_ENV=development
1717
[ "${TEST_SCENARIO}" = "${TEST_SCENARIO%%devel}" ] || OPTS="$OPTS --coverage"
1818
[ "${TEST_SCENARIO}" = "${TEST_SCENARIO##firefox}" ] || export TEST_BROWSER=firefox
@@ -26,7 +26,7 @@ case $TEST_SCENARIO in
2626
dnf-copr*)
2727
bots/image-customize -v --run-command 'dnf -y copr enable rpmsoftwaremanagement/dnf-nightly && dnf -y --setopt=install_weak_deps=False update' $TEST_OS
2828
test/image-prepare --verbose --overlay $TEST_OS
29-
test/common/run-tests --jobs ${TEST_JOBS:-1} --test-dir test/verify
29+
test/common/run-tests --jobs ${TEST_JOBS:-1} --test-dir test/verify --track-naughties
3030
;;
3131
*)
3232
echo "Unknown test scenario: $TEST_SCENARIO"

0 commit comments

Comments
 (0)