Repository navigation
Run the usage sharing builder tests, which JUnit 5 passed over - #142
Merged
Merged
Conversation
The module depends on JUnit 5 alone, so the JUnit 4 annotations meant none of these tests ran.
Once the tests ran, two of them disagreed with the setters' documented behaviour. The text form of setBlockedHttpHeaders adds to the list, as its Javadoc says, and a negative repeat interval is kept and shares every repeat, as 0 does. The repeat interval's Javadoc now gives the default of 20 minutes it has.
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
ShareUsageBuilderBaseTestholds 32 tests of the usage sharing builder's setters, and none of them has ever run. The class uses JUnit 4 (org.junit.Test,org.junit.Before,@Test(expected = ...)), while its module,pipeline/pipeline.engines.fiftyone, depends on JUnit 5 alone (pom.xml lines 61 to 64 at rc 23e0fc64). Surefire then runs the JUnit 5 engine only, and a JUnit 4 class there is passed over without a word. #62 noted that the class "did not run in any of the runs above".A check of every module on
rcthat has tests found no other module like this. Every other module whose tests use JUnit 4 gets JUnit 4, from its own pom or its parent's, and every other test inpipeline.engines.fiftyoneuses JUnit 5.What changed
ShareUsageBuilderBaseTest).@Beforebecomes@BeforeEach, each@Test(expected = IllegalArgumentException.class)becomesassertThrows, and oneassertEqualsgets its expected value first. Commit d386483.setBlockedHttpHeaderscalled the text form of the setter twice and expected the second list to replace the first. The text form adds to the list, as its Javadoc says ("This setter adds to the blocked headers"), where the list form replaces it. The test now expects all six names.setRepeatEvidenceIntervalMinutes1expected a negative interval to be refused. The setter keeps it, and the tracker then shares every repeat, as with 0, because a share is repeated once its time is at or before now less the interval (ShareUsageTracker, line 86 at rc 23e0fc64). The test, renamedsetRepeatEvidenceIntervalMinutes_Negative_Kept, now says so.Constants.SHARE_USAGE_DEFAULT_REPEAT_EVIDENCE_MINUTES, as the setter's own@DefaultValuenames, and as the specification's configuration options give). It now says "The default is 20 minutes. An interval of 0, or a negative one, shares every repeat." (ShareUsageBuilderBase.java). No code changes.Tests
The runs build
pipeline/pipeline.engines.fiftyonewith the modules it needs, on Java 17, run onlyShareUsageBuilderBaseTest, and fail if the class does not run.rc23e0fc6 with the workflow alone (1a66fbe): run 43596170862. "Tests run: 0", then "ShareUsageBuilderBaseTest did not run".setBlockedHttpHeaders("expected: <3> but was: <6>") andsetRepeatEvidenceIntervalMinutes1("Expected java.lang.IllegalArgumentException to be thrown, but nothing was thrown").rcb33daa0 was merged in: run 43596859236.ShareUsageBuilderBaseTestran 32 tests and none failed.rcb33daa0 is merged into this draft (merge commit a0e8326, no conflicts).Build
Run 43615566711 built a0e8326 merged with
rc(b33daa0) on nine configurations, Ubuntu x64 with Java 8, 11, 17 and 21, Ubuntu arm64 with Java 17, and Windows with Java 8, 11, 17 and 21, and every job passed.ShareUsageBuilderBaseTestran and passed 32 of 32 in all nine jobs. Each of its tenSetting 'PullRequestSha'lines names a0e8326, and its Configure job printed "Left out 6 macOS entries".macOS was left out of this draft's full build. The rc head is built with macOS before it merges into main.
A trial merge of the head with
rcat c2d982a, as it stood at 09:32 on 15 November, is clean.What remains
HttpClientDefaultcan only sendOriginwhen it setssun.net.http.allowRestrictedHeadersbefore the JDK's HTTP connection class first loads. That is not changed here, as it needs a decision on whether a package refuses to send, or warns, when the runtime drops a header it was configured to send. The decision is #189.