Skip to content

test(gradle): retry gradle plugin integration test on network failures - #1665

Open
lengau wants to merge 2 commits into
mainfrom
work/fix-gradle-flaky-test
Open

test(gradle): retry gradle plugin integration test on network failures#1665
lengau wants to merge 2 commits into
mainfrom
work/fix-gradle-flaky-test

Conversation

@lengau

@lengau lengau commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes flaky gradle integration test failures such as seen in https://github.com/canonical/craft-parts/actions/runs/31634098513/job/94239938405.

Root cause

test_gradle_plugin (when use_gradlew=True) runs the Gradle wrapper, which downloads the Gradle distribution zip from services.gradle.org. This occasionally fails with a transient 503 HTTP error, causing a PluginBuildError and failing the test even though there's no actual bug in craft-parts.

Fix

Marked test_gradle_plugin with @pytest.mark.flaky(reruns=3, only_rerun=["PluginBuildError"]), following the same established pattern used for other network-dependent integration tests in this repo (test_chisel.py, test_chisel_lifecycle.py, test_process.py).

Verified: file collects successfully with pytest --collect-only, syntax and ruff check pass.

The test_gradle_plugin integration test downloads the Gradle
distribution via the gradlew wrapper, which occasionally fails with
transient HTTP errors (e.g. 503) from services.gradle.org. Mark the
test as flaky with reruns so these network hiccups don't fail CI,
following the same pattern already used for other network-dependent
tests (e.g. test_chisel_lifecycle.py, test_chisel.py).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lengau
lengau requested a review from cmatsuoka as a code owner August 12, 2026 20:55
Copilot AI lite review requested due to automatic review settings August 12, 2026 20:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces CI flakiness in the Gradle plugin integration suite by retrying test_gradle_plugin when it fails with PluginBuildError, which can occur during transient network failures while the Gradle wrapper downloads its distribution.

Changes:

  • Mark test_gradle_plugin as flaky with reruns=3 when the failure is a PluginBuildError.
  • Add a clear reason string documenting the network-dependent failure mode (Gradle wrapper distribution download).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants