Menu

1 / 2

Our flaky-test rule had a hole: the PR that makes a test flaky (and two more "nothing happened" guards)

DEV Community: java·JavaCoder7·1 day ago
#aF4ki2ev
#devtojava#devto#dev#tests#codeguard
Long article (324 words) — no AI summary yet.
Reading 0:00
15s threshold

CodeGuard AI is a self-hosted PR reviewer for Java that runs your tests and lets the result overrule the AI. Right after 1.1.1, readers found two holes. Here is each one and how it was closed.

Hole 1: the PR that makes a test flaky. 1.1.1 reran a failing PR test once. If it passed and base never failed, it was called flaky and did not block. But a PR that introduces a race fails once, passes on the rerun, and base is clean, which is exactly the same picture. The fix compares counts. When the PR fails a test base did not, both sides run the same number of extra times (default 2) and each test is judged by its failure counts:

PR runs failing Base runs failing Result

all none PR broke it: BLOCK

some some already flaky: no block

some none PR most likely made it flaky: WARN (configurable)

The review shows the evidence, for example "failed in 1 of 3 runs on the PR and 0 of 3 on the base branch". A rerun that errors out is never counted as a pass.

Hole 2: runs that execute nothing.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.