From 36b5601588f1a07e13e518a2795a9f40fca8ffb3 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Wed, 1 Apr 2020 14:03:44 -0700 Subject: [PATCH 1/2] Add Jacoco report to site --- pom.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pom.xml b/pom.xml index 2ce3d0fc35..5a23e80d69 100644 --- a/pom.xml +++ b/pom.xml @@ -572,6 +572,10 @@ + + org.jacoco + jacoco-maven-plugin + org.apache.maven.plugins maven-gpg-plugin @@ -621,6 +625,18 @@ + + org.jacoco + jacoco-maven-plugin + + + + + report + + + + org.apache.maven.plugins maven-javadoc-plugin From ea7a1a717575cbf00b34e3cad689d2406fd1de2f Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Wed, 1 Apr 2020 14:22:17 -0700 Subject: [PATCH 2/2] More GHRateLimit test stabilization --- .../org/kohsuke/github/GHRateLimitTest.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/kohsuke/github/GHRateLimitTest.java b/src/test/java/org/kohsuke/github/GHRateLimitTest.java index fccca58950..a1e0cfe172 100644 --- a/src/test/java/org/kohsuke/github/GHRateLimitTest.java +++ b/src/test/java/org/kohsuke/github/GHRateLimitTest.java @@ -74,7 +74,7 @@ public void testGitHubRateLimit() throws Exception { GHRateLimit headerRateLimit = rateLimit; // Give this a moment - Thread.sleep(1000); + Thread.sleep(1500); // ratelimit() uses headerRateLimit if available and headerRateLimit is not expired assertThat(gitHub.rateLimit(), equalTo(headerRateLimit)); @@ -82,7 +82,7 @@ public void testGitHubRateLimit() throws Exception { assertThat(mockGitHub.getRequestCount(), equalTo(1)); // Give this a moment - Thread.sleep(1000); + Thread.sleep(1500); // Always requests new info rateLimit = gitHub.getRateLimit(); @@ -96,7 +96,7 @@ public void testGitHubRateLimit() throws Exception { previousLimit = rateLimit; // Give this a moment - Thread.sleep(1000); + Thread.sleep(1500); // Always requests new info rateLimit = gitHub.getRateLimit(); @@ -200,7 +200,7 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception { Date lastReset = new Date(System.currentTimeMillis() / 1000L); // Give this a moment - Thread.sleep(1000); + Thread.sleep(1500); // ------------------------------------------------------------- // Before any queries, rate limit starts as null but may be requested @@ -224,7 +224,7 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception { assertThat(mockGitHub.getRequestCount(), equalTo(1)); // Give this a moment - Thread.sleep(1000); + Thread.sleep(1500); // ------------------------------------------------------------- // First call to /user gets response without rate limit information @@ -244,7 +244,7 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception { assertThat(mockGitHub.getRequestCount(), equalTo(3)); // Give this a moment - Thread.sleep(1000); + Thread.sleep(1500); // Always requests new info rateLimit = gitHub.getRateLimit(); @@ -256,13 +256,13 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception { assertThat(rateLimit.getResetDate().compareTo(lastReset), equalTo(1)); // Give this a moment - Thread.sleep(1000); + Thread.sleep(1500); // last is still null, because it actually means lastHeaderRateLimit assertThat(gitHub.lastRateLimit(), CoreMatchers.nullValue()); // ratelimit() tries not to make additional requests, uses queried rate limit since header not available - Thread.sleep(1000); + Thread.sleep(1500); assertThat(gitHub.rateLimit(), sameInstance(rateLimit)); // ------------------------------------------------------------- @@ -283,7 +283,7 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception { GHRateLimit headerRateLimit = rateLimit; // Give this a moment - Thread.sleep(1000); + Thread.sleep(1500); // ratelimit() uses headerRateLimit if available and headerRateLimit is not expired assertThat(gitHub.rateLimit(), sameInstance(headerRateLimit)); @@ -291,7 +291,7 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception { assertThat(mockGitHub.getRequestCount(), equalTo(5)); // Give this a moment - Thread.sleep(1000); + Thread.sleep(1500); // Always requests new info rateLimit = gitHub.getRateLimit(); @@ -308,7 +308,7 @@ public void testGitHubEnterpriseDoesNotHaveRateLimit() throws Exception { assertThat(mockGitHub.getRequestCount(), equalTo(6)); // Wait for the header - Thread.sleep(1000); + Thread.sleep(1500); } @Test @@ -361,7 +361,7 @@ private void executeExpirationTest() throws Exception { GHRateLimit headerRateLimit = null; // Give this a moment - Thread.sleep(1000); + Thread.sleep(1500); // ------------------------------------------------------------- // /user gets response with rate limit information @@ -380,7 +380,7 @@ private void executeExpirationTest() throws Exception { sameInstance(headerRateLimit)); // Nothing changes still valid - Thread.sleep(1000); + Thread.sleep(1500); assertThat("rateLimit() selects header instance when not expired, does not ask server", gitHub.rateLimit(), @@ -392,7 +392,7 @@ private void executeExpirationTest() throws Exception { assertThat(mockGitHub.getRequestCount(), equalTo(1)); // This time, rateLimit() should find an expired record and get a new one. - Thread.sleep(3000); + Thread.sleep(2500); assertThat("Header instance has expired", gitHub.lastRateLimit().isExpired(), is(true));