Repository navigation
Test the stated span with a key that covers now - #10
Merged
Merged
Conversation
The test that checks a recent minute is served from a span the creator stated read the clock, whilst the stand in end point it used answers for no moment after 14 September 2026. From 21 September 2026 the end point therefore answered with a key whose span did not hold the minutes asked about, each one was fetched, and the test failed with three requests where it expects one. The creator in the test now states one key for the day either side of now, as the .NET test does, so the test no longer depends on the dates in the fixture schedule and keeps checking after the last key in the fixture has started.
This was referenced Oct 5, 2026
jwrosewell
marked this pull request as ready for review
October 6, 2026 16:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DatedKeyFetchTest.aRecentMinuteIsServedWhereTheCreatorStatedTheSpanfails onmainon any day from 21 September 2026. Run onmainat 0022d3f on 5 October 2026 on Java 8, 11 and 17, the CI command gives the result below on each.The last CI run on
mainwas on 7 September 2026, before the date mattered, somainstill shows a green tick.Cause
The test reads the clock and asks for the key at three minutes near now. The stand in end point the test used fixes the moment of a request at 14 September 2026 and reads any later date as that moment (
REQUEST_MOMENTinsrc/test/java/com/swancommunity/owid/KeyEndPoint.java). Up to 20 September the answer was the key in force now, with a span that held all three minutes, so one request served them. From 21 September the answer is the key for the week of 14 September, whose span holds none of the minutes asked about, so each minute is fetched and the test counts three requests.Change
The creator in this test now states one key for the day either side of now, built with
Endpoints.publicKeyAnswer, in place of the fixture schedule. The three requests and the assertion are unchanged. TheassumeTruethat depended on the fixture schedule is gone, so the test also keeps checking after 30 November 2026, when the last key in the fixture starts and the old test would have been skipped.No existing kind of answer of the stand in end point states a span that holds the present, so
KeyEndPoint.Answergains one kind,GIVEN, which serves the body passed to the existingstart(Answer, String)whatever the request asks for. That parameter is renamed fromredirectTotogiven, because the text is now either where to redirect or the body to serve. Every other kind of answer takes the same path as before.The .NET library's test of the same behaviour is already written this way, as
ARecentMinuteIsServedWhereTheCreatorStatedTheSpaninOwid.Client.Test/PublicKeyFetchTests.cs, and the Rust and Python libraries have the same change in SWAN-community/owid-rust#13 and SWAN-community/owid-python#8.Two files under
src/testchange. No library code or fixture changes.Verification
Run on Windows on 5 October 2026 with Maven 3.9.16, using the one command of the CI workflow.
mvn --batch-mode --update-snapshots testends in BUILD SUCCESS with 146 tests run and 0 failures on each of Java 8, 11 and 17, wheremaingives the one failure above on each.heldForinsrc/main/java/com/swancommunity/owid/PublicKeyFetch.javachanged from(key.explicit || recent == false)torecent == false, the changed test fails withexpected: <1> but was: <3>, so the test still depends on the behaviour its name describes. That change was then put back.Outstanding
The same test in the Go, Java, PHP, Python and Rust libraries has the same cause, and failed in each when the one test was run on each
mainon 5 October 2026. The other four are changed in SWAN-community/owid-rust#13, SWAN-community/owid-go#19, SWAN-community/owid-php#7 and SWAN-community/owid-python#8.