From 46a141db9cbc63a6a6711d10cc747a79259386d4 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Tue, 25 Feb 2020 14:43:03 -0800 Subject: [PATCH] Use consistent templating for all tests --- .../github/AbstractGitHubWireMockTest.java | 25 ++++++++++ .../kohsuke/github/AbuseLimitHandlerTest.java | 4 +- .../org/kohsuke/github/GHRateLimitTest.java | 48 ++++++++++++------- .../kohsuke/github/RateLimitCheckerTest.java | 24 +--------- .../kohsuke/github/RateLimitHandlerTest.java | 4 +- .../github/extras/GitHubCachingTest.java | 4 +- .../github/extras/OkHttpConnectorTest.java | 4 +- .../extras/okhttp3/GitHubCachingTest.java | 3 +- .../extras/okhttp3/OkHttpConnectorTest.java | 3 +- ...mp-testratelimithandler_fail-2-79fb10.json | 2 +- ...mp-testratelimithandler_fail-3-574da1.json | 2 +- .../mappings/user-1-a60baf.json | 4 +- ...mp-testratelimithandler_fail-2-79fb10.json | 2 +- ...mp-testratelimithandler_fail-3-574da1.json | 2 +- .../mappings/user-1-a60baf.json | 4 +- ...mp-testratelimithandler_fail-2-79fb10.json | 2 +- ...mp-testratelimithandler_fail-3-574da1.json | 2 +- .../mappings/user-1-a60baf.json | 4 +- ...mp-testratelimithandler_fail-2-79fb10.json | 2 +- .../mappings/user-1-a60baf.json | 4 +- .../mappings/user-1-a0bafd.json | 2 +- ...-4e2fc33b-fb25-4dfc-9d56-34f9b4d707be.json | 8 ++-- ...-a1f82a96-500c-4462-ae7b-e0159afa8208.json | 8 ++-- ...-f22b1cea-3679-481d-8b95-459b2c47bf98.json | 8 ++-- .../orgs_github-api-test-org-4-7ea37b.json | 2 +- .../mappings/rate_limit-2-f22b1c.json | 2 +- .../mappings/rate_limit-3-a1f82a.json | 2 +- .../mappings/rate_limit-5-4e2fc3.json | 2 +- .../mappings/user-1-a460fd.json | 2 +- ...mp-testratelimithandler_fail-2-79fb10.json | 2 +- ...mp-testratelimithandler_fail-3-574da1.json | 2 +- .../mappings/user-1-a60baf.json | 2 +- ...mp-testratelimithandler_fail-2-79fb10.json | 2 +- ...mp-testratelimithandler_fail-3-574da1.json | 2 +- .../mappings/user-1-a60baf.json | 2 +- ...mp-testratelimithandler_fail-2-79fb10.json | 2 +- ...mp-testratelimithandler_fail-3-574da1.json | 2 +- .../mappings/user-1-a60baf.json | 2 +- ...mp-testratelimithandler_fail-2-79fb10.json | 2 +- .../mappings/user-1-a60baf.json | 2 +- 40 files changed, 108 insertions(+), 99 deletions(-) diff --git a/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java b/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java index 33dfe3546..5a50a194b 100644 --- a/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java +++ b/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java @@ -1,6 +1,8 @@ package org.kohsuke.github; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; +import com.github.tomakehurst.wiremock.extension.responsetemplating.helpers.HandlebarsCurrentDateHelper; import org.apache.commons.io.IOUtils; import org.hamcrest.Description; import org.hamcrest.Matcher; @@ -11,6 +13,8 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.kohsuke.github.junit.GitHubWireMockRule; +import wiremock.com.github.jknack.handlebars.Helper; +import wiremock.com.github.jknack.handlebars.Options; import java.io.File; import java.io.FileInputStream; @@ -48,6 +52,8 @@ public abstract class AbstractGitHubWireMockTest extends Assert { @Rule public final GitHubWireMockRule mockGitHub; + protected final TemplatingHelper templating = new TemplatingHelper(); + public AbstractGitHubWireMockTest() { mockGitHub = new GitHubWireMockRule(this.getWireMockOptions()); } @@ -285,4 +291,23 @@ public abstract class AbstractGitHubWireMockTest extends Assert { assertThat(condition, Matchers.is(false)); } + protected static class TemplatingHelper { + public Date testStartDate = new Date(); + + public ResponseTemplateTransformer newResponseTransformer() { + testStartDate = new Date(); + return ResponseTemplateTransformer.builder() + .global(true) + .maxCacheEntries(0L) + .helper("testStartDate", new Helper() { + private HandlebarsCurrentDateHelper helper = new HandlebarsCurrentDateHelper(); + @Override + public Object apply(final Object context, final Options options) throws IOException { + return this.helper.apply(TemplatingHelper.this.testStartDate, options); + } + }) + .build(); + } + } + } diff --git a/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java b/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java index 7be4cc322..ccded7c6e 100644 --- a/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java +++ b/src/test/java/org/kohsuke/github/AbuseLimitHandlerTest.java @@ -1,7 +1,6 @@ package org.kohsuke.github; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; import org.junit.Test; import java.io.IOException; @@ -36,8 +35,7 @@ public class AbuseLimitHandlerTest extends AbstractGitHubWireMockTest { @Override protected WireMockConfiguration getWireMockOptions() { - return super.getWireMockOptions() - .extensions(ResponseTemplateTransformer.builder().global(true).maxCacheEntries(0L).build()); + return super.getWireMockOptions().extensions(templating.newResponseTransformer()); } @Test diff --git a/src/test/java/org/kohsuke/github/GHRateLimitTest.java b/src/test/java/org/kohsuke/github/GHRateLimitTest.java index 7b8608740..3763284dc 100644 --- a/src/test/java/org/kohsuke/github/GHRateLimitTest.java +++ b/src/test/java/org/kohsuke/github/GHRateLimitTest.java @@ -3,15 +3,14 @@ package org.kohsuke.github; import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.ValueInstantiationException; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; import org.hamcrest.CoreMatchers; import org.junit.Test; import java.io.IOException; +import java.time.Duration; import java.util.Date; import static org.hamcrest.CoreMatchers.*; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.core.IsInstanceOf.instanceOf; /** @@ -43,8 +42,7 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { @Override protected WireMockConfiguration getWireMockOptions() { - return super.getWireMockOptions() - .extensions(ResponseTemplateTransformer.builder().global(true).maxCacheEntries(0L).build()); + return super.getWireMockOptions().extensions(templating.newResponseTransformer()); } @Test @@ -55,11 +53,9 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { assertThat(mockGitHub.getRequestCount(), equalTo(0)); // 4897 is just the what the limit was when the snapshot was taken - previousLimit = GHRateLimit - .fromHeaderRecord(new GHRateLimit.Record(5000, 4897, System.currentTimeMillis() / 1000L)); - - // Give this a moment - Thread.sleep(1000); + previousLimit = GHRateLimit.fromHeaderRecord(new GHRateLimit.Record(5000, + 4897, + (templating.testStartDate.getTime() + Duration.ofHours(1).toMillis()) / 1000L)); // ------------------------------------------------------------- // /user gets response with rate limit information @@ -90,6 +86,9 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { rateLimit = gitHub.getRateLimit(); assertThat(mockGitHub.getRequestCount(), equalTo(2)); + // Because remaining and reset date are unchanged, the header should be unchanged as well + assertThat(gitHub.lastRateLimit(), sameInstance(headerRateLimit)); + // rate limit request is free, remaining is unchanged verifyRateLimitValues(previousLimit, previousLimit.getRemaining()); previousLimit = rateLimit; @@ -101,6 +100,9 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { rateLimit = gitHub.getRateLimit(); assertThat(mockGitHub.getRequestCount(), equalTo(3)); + // Because remaining and reset date are unchanged, the header should be unchanged as well + assertThat(gitHub.lastRateLimit(), sameInstance(headerRateLimit)); + // rate limit request is free, remaining is unchanged verifyRateLimitValues(previousLimit, previousLimit.getRemaining()); previousLimit = rateLimit; @@ -108,6 +110,8 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { gitHub.getOrganization(GITHUB_API_TEST_ORG); assertThat(mockGitHub.getRequestCount(), equalTo(4)); + // Because remaining has changed the header should be different + assertThat(gitHub.lastRateLimit(), not(sameInstance(headerRateLimit))); assertThat(gitHub.lastRateLimit(), not(equalTo(headerRateLimit))); rateLimit = gitHub.lastRateLimit(); @@ -118,10 +122,12 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { headerRateLimit = rateLimit; // ratelimit() should prefer headerRateLimit when it is most recent and not expired - assertThat(gitHub.rateLimit(), equalTo(headerRateLimit)); + assertThat(gitHub.rateLimit(), sameInstance(headerRateLimit)); assertThat(mockGitHub.getRequestCount(), equalTo(4)); + // AT THIS POINT WE SIMULATE A RATE LIMIT RESET + // Give this a moment Thread.sleep(2000); @@ -129,8 +135,8 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { rateLimit = gitHub.getRateLimit(); assertThat(mockGitHub.getRequestCount(), equalTo(5)); - // rate limit request is free, remaining is unchanged - verifyRateLimitValues(previousLimit, previousLimit.getRemaining()); + // rate limit request is free, remaining is unchanged date is later + verifyRateLimitValues(previousLimit, previousLimit.getRemaining(), true); previousLimit = rateLimit; // When getRateLimit() succeeds, headerRateLimit updates as usual as well (if needed) @@ -142,7 +148,7 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { // Verify different instances can be compared // TODO: This is not work currently because the header rate limit has unknowns for records other than core. - // assertThat(gitHub.rateLimit().getCore(), equalTo(rateLimit.getCore())); + // assertThat(gitHub.rateLimit(), equalTo(rateLimit)); assertThat(gitHub.rateLimit(), not(sameInstance(headerRateLimit))); assertThat(gitHub.rateLimit(), sameInstance(gitHub.lastRateLimit())); @@ -151,13 +157,20 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { } private void verifyRateLimitValues(GHRateLimit previousLimit, int remaining) { + verifyRateLimitValues(previousLimit, remaining, false); + } + + private void verifyRateLimitValues(GHRateLimit previousLimit, int remaining, boolean changedResetDate) { + // newer or unchange + int resetComparisionValue = changedResetDate ? 1 : 0; + // Basic checks of values assertThat(rateLimit, notNullValue()); assertThat(rateLimit.getLimit(), equalTo(previousLimit.getLimit())); assertThat(rateLimit.getRemaining(), equalTo(remaining)); // Check that the reset date of the current limit is not older than the previous one - assertThat(rateLimit.getResetDate().compareTo(previousLimit.getResetDate()), greaterThanOrEqualTo(0)); + assertThat(rateLimit.getResetDate().compareTo(previousLimit.getResetDate()), equalTo(resetComparisionValue)); // Additional checks for record values assertThat(rateLimit.getCore().getLimit(), equalTo(rateLimit.getLimit())); @@ -257,7 +270,8 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { assertThat(rateLimit, notNullValue()); assertThat(rateLimit.getLimit(), equalTo(5000)); assertThat(rateLimit.getRemaining(), equalTo(4978)); - assertThat(rateLimit.getResetDate().compareTo(lastReset), greaterThanOrEqualTo(0)); + // The previous record was an "Unknown", so even though this records resets sooner we take it + assertThat(rateLimit.getResetDate().compareTo(lastReset), equalTo(-1)); lastReset = rateLimit.getResetDate(); GHRateLimit headerRateLimit = rateLimit; @@ -266,7 +280,7 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { Thread.sleep(1000); // ratelimit() uses headerRateLimit if available and headerRateLimit is not expired - assertThat(gitHub.rateLimit(), equalTo(headerRateLimit)); + assertThat(gitHub.rateLimit(), sameInstance(headerRateLimit)); assertThat(mockGitHub.getRequestCount(), equalTo(5)); @@ -365,7 +379,7 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest { assertThat("rateLimit() selects header instance when not expired, does not ask server", gitHub.rateLimit(), sameInstance(headerRateLimit)); - assertThat("rateLimit() selects header instance when not expired, does not ask server", + assertThat("lastRateLimit() always selects header instance, does not ask server", gitHub.lastRateLimit(), sameInstance(headerRateLimit)); diff --git a/src/test/java/org/kohsuke/github/RateLimitCheckerTest.java b/src/test/java/org/kohsuke/github/RateLimitCheckerTest.java index bf2845537..efebee01b 100644 --- a/src/test/java/org/kohsuke/github/RateLimitCheckerTest.java +++ b/src/test/java/org/kohsuke/github/RateLimitCheckerTest.java @@ -1,11 +1,7 @@ package org.kohsuke.github; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; -import com.github.tomakehurst.wiremock.extension.responsetemplating.helpers.HandlebarsCurrentDateHelper; import org.junit.Test; -import wiremock.com.github.jknack.handlebars.Helper; -import wiremock.com.github.jknack.handlebars.Options; import java.io.IOException; import java.util.Date; @@ -22,7 +18,6 @@ public class RateLimitCheckerTest extends AbstractGitHubWireMockTest { GHRateLimit rateLimit = null; GHRateLimit previousLimit = null; - Date testStartDate = new Date(); public RateLimitCheckerTest() { useDefaultGitHub = false; @@ -30,18 +25,7 @@ public class RateLimitCheckerTest extends AbstractGitHubWireMockTest { @Override protected WireMockConfiguration getWireMockOptions() { - - return super.getWireMockOptions().extensions(ResponseTemplateTransformer.builder() - .global(true) - .maxCacheEntries(0L) - .helper("testStartDate", new Helper() { - private HandlebarsCurrentDateHelper helper = new HandlebarsCurrentDateHelper(); - @Override - public Object apply(final Object context, final Options options) throws IOException { - return this.helper.apply(RateLimitCheckerTest.this.testStartDate, options); - } - }) - .build()); + return super.getWireMockOptions().extensions(templating.newResponseTransformer()); } @Test @@ -51,14 +35,10 @@ public class RateLimitCheckerTest extends AbstractGitHubWireMockTest { assertThat(mockGitHub.getRequestCount(), equalTo(0)); - // // 4897 is just the what the limit was when the snapshot was taken - // previousLimit = GHRateLimit - // .fromHeaderRecord(new GHRateLimit.Record(5000, 4897, System.currentTimeMillis() / 1000L)); - // Give this a moment Thread.sleep(1000); - testStartDate = new Date(); + templating.testStartDate = new Date(); // ------------------------------------------------------------- // /user gets response with rate limit information gitHub = getGitHubBuilder().withRateLimitChecker(new RateLimitChecker.LiteralValue(4500)) diff --git a/src/test/java/org/kohsuke/github/RateLimitHandlerTest.java b/src/test/java/org/kohsuke/github/RateLimitHandlerTest.java index 934b067b4..f2b2eb47f 100644 --- a/src/test/java/org/kohsuke/github/RateLimitHandlerTest.java +++ b/src/test/java/org/kohsuke/github/RateLimitHandlerTest.java @@ -1,7 +1,6 @@ package org.kohsuke.github; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; import org.junit.Test; import java.io.IOException; @@ -36,8 +35,7 @@ public class RateLimitHandlerTest extends AbstractGitHubWireMockTest { @Override protected WireMockConfiguration getWireMockOptions() { - return super.getWireMockOptions() - .extensions(ResponseTemplateTransformer.builder().global(true).maxCacheEntries(0L).build()); + return super.getWireMockOptions().extensions(templating.newResponseTransformer()); } @Test diff --git a/src/test/java/org/kohsuke/github/extras/GitHubCachingTest.java b/src/test/java/org/kohsuke/github/extras/GitHubCachingTest.java index b65d57131..2a30f5d2a 100644 --- a/src/test/java/org/kohsuke/github/extras/GitHubCachingTest.java +++ b/src/test/java/org/kohsuke/github/extras/GitHubCachingTest.java @@ -1,7 +1,6 @@ package org.kohsuke.github.extras; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; import com.squareup.okhttp.Cache; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.OkUrlFactory; @@ -36,8 +35,7 @@ public class GitHubCachingTest extends AbstractGitHubWireMockTest { @Override protected WireMockConfiguration getWireMockOptions() { - return super.getWireMockOptions() - .extensions(ResponseTemplateTransformer.builder().global(true).maxCacheEntries(0L).build()); + return super.getWireMockOptions().extensions(templating.newResponseTransformer()); } @Before diff --git a/src/test/java/org/kohsuke/github/extras/OkHttpConnectorTest.java b/src/test/java/org/kohsuke/github/extras/OkHttpConnectorTest.java index 96141ce4f..5eeebbf22 100644 --- a/src/test/java/org/kohsuke/github/extras/OkHttpConnectorTest.java +++ b/src/test/java/org/kohsuke/github/extras/OkHttpConnectorTest.java @@ -1,7 +1,6 @@ package org.kohsuke.github.extras; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; import com.squareup.okhttp.Cache; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.OkUrlFactory; @@ -66,8 +65,7 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest { @Override protected WireMockConfiguration getWireMockOptions() { - return super.getWireMockOptions() - .extensions(ResponseTemplateTransformer.builder().global(true).maxCacheEntries(0L).build()); + return super.getWireMockOptions().extensions(templating.newResponseTransformer()); } @Before diff --git a/src/test/java/org/kohsuke/github/extras/okhttp3/GitHubCachingTest.java b/src/test/java/org/kohsuke/github/extras/okhttp3/GitHubCachingTest.java index d44595be3..17ea73026 100644 --- a/src/test/java/org/kohsuke/github/extras/okhttp3/GitHubCachingTest.java +++ b/src/test/java/org/kohsuke/github/extras/okhttp3/GitHubCachingTest.java @@ -1,7 +1,6 @@ package org.kohsuke.github.extras.okhttp3; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; import okhttp3.Cache; import okhttp3.OkHttpClient; import org.apache.commons.io.FileUtils; @@ -38,7 +37,7 @@ public class GitHubCachingTest extends AbstractGitHubWireMockTest { return super.getWireMockOptions() // Use the same data files as the 2.x test .usingFilesUnderDirectory(baseRecordPath.replace("/okhttp3/", "/")) - .extensions(ResponseTemplateTransformer.builder().global(true).maxCacheEntries(0L).build()); + .extensions(templating.newResponseTransformer()); } @Before diff --git a/src/test/java/org/kohsuke/github/extras/okhttp3/OkHttpConnectorTest.java b/src/test/java/org/kohsuke/github/extras/okhttp3/OkHttpConnectorTest.java index 4797b30c1..5a04cd7c5 100644 --- a/src/test/java/org/kohsuke/github/extras/okhttp3/OkHttpConnectorTest.java +++ b/src/test/java/org/kohsuke/github/extras/okhttp3/OkHttpConnectorTest.java @@ -1,7 +1,6 @@ package org.kohsuke.github.extras.okhttp3; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; import com.github.tomakehurst.wiremock.matching.RequestPatternBuilder; import okhttp3.Cache; import okhttp3.OkHttpClient; @@ -72,7 +71,7 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest { return super.getWireMockOptions() // Use the same data files as the 2.x test .usingFilesUnderDirectory(baseRecordPath.replace("/okhttp3/", "/")) - .extensions(ResponseTemplateTransformer.builder().global(true).maxCacheEntries(0L).build()); + .extensions(templating.newResponseTransformer()); } @Before diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json index 5d27eff18..88aecaa22 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json @@ -21,7 +21,7 @@ "Retry-After": "30", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4000", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json index ce5bf4e38..5ecaf7f50 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4922", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json index 65ea20d5f..b13834e2e 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json @@ -14,13 +14,13 @@ "status": 200, "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json", "headers": { - "Date": "Thu, 06 Feb 2020 18:33:32 GMT", + "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4930", - "X-RateLimit-Reset": "1581014122", + "X-RateLimit-Reset": "{{now offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json index 5d27eff18..88aecaa22 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json @@ -21,7 +21,7 @@ "Retry-After": "30", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4000", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json index ce5bf4e38..5ecaf7f50 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4922", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json index 65ea20d5f..b13834e2e 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json @@ -14,13 +14,13 @@ "status": 200, "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json", "headers": { - "Date": "Thu, 06 Feb 2020 18:33:32 GMT", + "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4930", - "X-RateLimit-Reset": "1581014122", + "X-RateLimit-Reset": "{{now offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json index b7e939c4e..4f8a20a0a 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json @@ -21,7 +21,7 @@ "Retry-After": "2", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4000", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json index 53f1e9992..590fdfc13 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4922", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json index 65ea20d5f..b13834e2e 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json @@ -14,13 +14,13 @@ "status": 200, "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json", "headers": { - "Date": "Thu, 06 Feb 2020 18:33:32 GMT", + "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4930", - "X-RateLimit-Reset": "1581014122", + "X-RateLimit-Reset": "{{now offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json index 3455eb9b4..b328c5c2d 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json @@ -21,7 +21,7 @@ "Retry-After": "3", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4000", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json index 65ea20d5f..b13834e2e 100644 --- a/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json +++ b/src/test/resources/org/kohsuke/github/AbuseLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json @@ -14,13 +14,13 @@ "status": 200, "bodyFileName": "user-a60baf84-5b5c-4f86-af3d-cab0d609c7b2.json", "headers": { - "Date": "Thu, 06 Feb 2020 18:33:32 GMT", + "Date": "{{now timezone='GMT' format='EEE, dd MMM yyyy HH:mm:ss z'}}", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4930", - "X-RateLimit-Reset": "1581014122", + "X-RateLimit-Reset": "{{now offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubEnterpriseDoesNotHaveRateLimit/mappings/user-1-a0bafd.json b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubEnterpriseDoesNotHaveRateLimit/mappings/user-1-a0bafd.json index 9702f0a9c..2aa1fcf5e 100644 --- a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubEnterpriseDoesNotHaveRateLimit/mappings/user-1-a0bafd.json +++ b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubEnterpriseDoesNotHaveRateLimit/mappings/user-1-a0bafd.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4978", - "X-RateLimit-Reset": "{{now offset='1 hours' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='1 hours' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-4e2fc33b-fb25-4dfc-9d56-34f9b4d707be.json b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-4e2fc33b-fb25-4dfc-9d56-34f9b4d707be.json index 607385447..f5c24bd24 100644 --- a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-4e2fc33b-fb25-4dfc-9d56-34f9b4d707be.json +++ b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-4e2fc33b-fb25-4dfc-9d56-34f9b4d707be.json @@ -3,22 +3,22 @@ "core": { "limit": 5000, "remaining": 4896, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='63 minutes' format='unix'}} }, "search": { "limit": 30, "remaining": 30, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} }, "graphql": { "limit": 5000, "remaining": 5000, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} }, "integration_manifest": { "limit": 5000, "remaining": 5000, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} } }, "rate": { diff --git a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-a1f82a96-500c-4462-ae7b-e0159afa8208.json b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-a1f82a96-500c-4462-ae7b-e0159afa8208.json index e5881bcd4..508766ff5 100644 --- a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-a1f82a96-500c-4462-ae7b-e0159afa8208.json +++ b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-a1f82a96-500c-4462-ae7b-e0159afa8208.json @@ -3,22 +3,22 @@ "core": { "limit": 5000, "remaining": 4897, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} }, "search": { "limit": 30, "remaining": 30, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} }, "graphql": { "limit": 5000, "remaining": 5000, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} }, "integration_manifest": { "limit": 5000, "remaining": 5000, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} } }, "rate": { diff --git a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-f22b1cea-3679-481d-8b95-459b2c47bf98.json b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-f22b1cea-3679-481d-8b95-459b2c47bf98.json index e5881bcd4..508766ff5 100644 --- a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-f22b1cea-3679-481d-8b95-459b2c47bf98.json +++ b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/__files/rate_limit-f22b1cea-3679-481d-8b95-459b2c47bf98.json @@ -3,22 +3,22 @@ "core": { "limit": 5000, "remaining": 4897, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} }, "search": { "limit": 30, "remaining": 30, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} }, "graphql": { "limit": 5000, "remaining": 5000, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} }, "integration_manifest": { "limit": 5000, "remaining": 5000, - "reset": {{now offset='1 hours' format='unix'}} + "reset": {{testStartDate offset='1 hours' format='unix'}} } }, "rate": { diff --git a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/orgs_github-api-test-org-4-7ea37b.json b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/orgs_github-api-test-org-4-7ea37b.json index 7a79015c4..8da888a4f 100644 --- a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/orgs_github-api-test-org-4-7ea37b.json +++ b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/orgs_github-api-test-org-4-7ea37b.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4896", - "X-RateLimit-Reset": "{{now offset='1 hours' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='1 hours' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-2-f22b1c.json b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-2-f22b1c.json index aaf33e605..473e4c8a7 100644 --- a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-2-f22b1c.json +++ b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-2-f22b1c.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4897", - "X-RateLimit-Reset": "{{now offset='1 hours' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='1 hours' format='unix'}}", "Cache-Control": "no-cache", "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", "X-Accepted-OAuth-Scopes": "", diff --git a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-3-a1f82a.json b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-3-a1f82a.json index 6eed67154..fdebc86e8 100644 --- a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-3-a1f82a.json +++ b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-3-a1f82a.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4897", - "X-RateLimit-Reset": "{{now offset='1 hours' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='1 hours' format='unix'}}", "Cache-Control": "no-cache", "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", "X-Accepted-OAuth-Scopes": "", diff --git a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-5-4e2fc3.json b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-5-4e2fc3.json index a4ea991d8..c5e180bf5 100644 --- a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-5-4e2fc3.json +++ b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/rate_limit-5-4e2fc3.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4896", - "X-RateLimit-Reset": "{{now offset='1 hours' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='63 minutes' format='unix'}}", "Cache-Control": "no-cache", "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", "X-Accepted-OAuth-Scopes": "", diff --git a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/user-1-a460fd.json b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/user-1-a460fd.json index a88b59ba4..ea06d1f29 100644 --- a/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/user-1-a460fd.json +++ b/src/test/resources/org/kohsuke/github/GHRateLimitTest/wiremock/testGitHubRateLimit/mappings/user-1-a460fd.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4897", - "X-RateLimit-Reset": "{{now offset='1 hours' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='1 hours' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json index 9a3217193..615505f5b 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json @@ -20,7 +20,7 @@ "Status": "403 Forbidden", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "0", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json index ce5bf4e38..5ecaf7f50 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4922", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json index 65ea20d5f..ecb5a24f9 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Fail/mappings/user-1-a60baf.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4930", - "X-RateLimit-Reset": "1581014122", + "X-RateLimit-Reset": "{{now offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json index 9a3217193..615505f5b 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json @@ -20,7 +20,7 @@ "Status": "403 Forbidden", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "0", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json index ce5bf4e38..5ecaf7f50 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4922", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json index 65ea20d5f..ecb5a24f9 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_HttpStatus_Fail/mappings/user-1-a60baf.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4930", - "X-RateLimit-Reset": "1581014122", + "X-RateLimit-Reset": "{{now offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json index 8f38ec649..20ffe1684 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json @@ -20,7 +20,7 @@ "Status": "403 Forbidden", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "0", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json index 53f1e9992..590fdfc13 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-3-574da1.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4922", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json index 65ea20d5f..ecb5a24f9 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_Wait/mappings/user-1-a60baf.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4930", - "X-RateLimit-Reset": "1581014122", + "X-RateLimit-Reset": "{{now offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json index 693389452..b7317b24e 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/repos_github-api-test-org_temp-testratelimithandler_fail-2-79fb10.json @@ -20,7 +20,7 @@ "Status": "403 Forbidden", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "0", - "X-RateLimit-Reset": "{{now offset='2 seconds' format='unix'}}", + "X-RateLimit-Reset": "{{testStartDate offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", diff --git a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json index 65ea20d5f..ecb5a24f9 100644 --- a/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json +++ b/src/test/resources/org/kohsuke/github/RateLimitHandlerTest/wiremock/testHandler_WaitStuck/mappings/user-1-a60baf.json @@ -20,7 +20,7 @@ "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4930", - "X-RateLimit-Reset": "1581014122", + "X-RateLimit-Reset": "{{now offset='3 seconds' format='unix'}}", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP",