ham1 opened a new pull request, #6891: URL: https://github.com/apache/jmeter/pull/6891
## Description The cache manager expiry tests no longer sleep. `CacheManager` reads the time from a `java.time.Clock`, and the tests set that clock instead of waiting for entries to expire. ## Motivation and Context `TestCacheManagerHC4`, `TestCacheManagerHeaderSource` and `TestCacheManagerUrlConnection` each took about 28s, almost all of it sleeping. The benefit is a faster HTTP test loop: `:src:protocol:http:test` took 70-109s in the four CI jobs of this branch, against 170-182s in the four jobs of an earlier run without the change. Total CI build time is mostly unchanged. These are single runs on randomly chosen operating systems and JDKs, so treat the figures as approximate. The tests also no longer depend on how precisely the machine sleeps. Production behaviour should be unchanged. Only a new package-private constructor sets a clock; otherwise the time still comes from `System.currentTimeMillis()`. The clock is transient and is not a test element property. **Question for reviewers:** three private methods (`extractExpiresDateFromCacheControl`, `calcExpiresDate` and `entryStillValid`) are no longer `static`, because they now read the clock of the instance. Is that a problem? The alternative would be to pass the time or the clock to them as a parameter. ## How Has This Been Tested? The existing expiry tests now set the clock. A new test checks that a clone and a cache manager proxy use the same clock. CI on the fork passed in all four test jobs (1079 HTTP tests, no failures). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
