Skip to content

[TASK] Stabilize functional tests against Wikimedia rate limiting - #100

Open
SvenJuergens wants to merge 3 commits into
IchHabRecht:mainfrom
SvenJuergens:task/stabilize-ci-wikimedia
Open

SvenJuergens wants to merge 3 commits into
IchHabRecht:mainfrom
SvenJuergens:task/stabilize-ci-wikimedia

Conversation

@SvenJuergens

Copy link
Copy Markdown

Problem

The functional test suite fetches real files from upload.wikimedia.org. Wikimedia enforces its robot policy for requests coming from cloud IP ranges (such as GitHub Actions runners) and throttles them with 429 Too many requests / 429 Your request does not comply with our robot policy.

When the domain resource is throttled, the placehold fallback serves the file instead. Most tests still pass (they only assert non-empty content), but FilefillTest::fileExistsWithDomainResource asserts that the file was fetched by the domain resource and fails. This is why the CI on main is currently red and PR runs fail intermittently.

Solution

Two small changes to the test setup only, no production code is touched:

  1. Send a descriptive User-Agent in the test instance instead of the generic default TYPO3, as required by the Wikimedia robot policy.
  2. Skip fileExistsWithDomainResource when Wikimedia is not reachable: the test now probes the remote file with a HEAD request first and calls markTestSkipped() when it does not answer with 200, instead of reporting a false negative. Locally the test still runs and asserts the full behaviour.

Verified on a fork with the same workflows: with both changes all matrix jobs are green (example run) — the domain test runs fully when Wikimedia allows it and is skipped transparently when the runner IP is throttled.

Wikimedia throttles requests with a generic User-Agent coming
from cloud IP ranges (robot policy, https://w.wiki/4wJS), which
made fileExistsWithDomainResource fail on GitHub Actions runners.
Wikimedia throttles requests from cloud IP ranges like GitHub
Actions runners (robot policy, https://w.wiki/4wJS). When the
domain resource is throttled, the placehold fallback serves the
file and the tx_filefill_identifier assertion fails. Skip the
test in this case instead of reporting a false negative.
Parallel CI jobs share the runner IP pool, so Wikimedia may start
throttling between the initial probe and the actual fetch. When
the domain resource did not serve the file, probe the remote again
and skip instead of failing. Use GET for the probe to mirror the
actual fetch request.
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant