diff --git a/.junit.run/Not Slow.run.xml b/.junit.run/Not Slow.run.xml new file mode 100644 index 000000000..a0e3710a9 --- /dev/null +++ b/.junit.run/Not Slow.run.xml @@ -0,0 +1,17 @@ + + + + + + + + + \ No newline at end of file diff --git a/android-test/src/androidTest/java/okhttp/android/test/OkHttpTest.kt b/android-test/src/androidTest/java/okhttp/android/test/OkHttpTest.kt index 12621a20e..b2511439a 100644 --- a/android-test/src/androidTest/java/okhttp/android/test/OkHttpTest.kt +++ b/android-test/src/androidTest/java/okhttp/android/test/OkHttpTest.kt @@ -60,6 +60,7 @@ import org.junit.jupiter.api.Assertions.fail import org.junit.jupiter.api.Assumptions.assumeTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.extension.RegisterExtension @@ -88,6 +89,7 @@ import javax.net.ssl.X509TrustManager * Run with "./gradlew :android-test:connectedCheck" and make sure ANDROID_SDK_ROOT is set. */ @ExtendWith(MockWebServerExtension::class) +@Tag("Slow") class OkHttpTest(val server: MockWebServer) { @Suppress("RedundantVisibilityModifier") @JvmField diff --git a/android-test/src/androidTest/java/okhttp/android/test/letsencrypt/LetsEncryptClientTest.kt b/android-test/src/androidTest/java/okhttp/android/test/letsencrypt/LetsEncryptClientTest.kt index 5e6e72557..b2cd95264 100644 --- a/android-test/src/androidTest/java/okhttp/android/test/letsencrypt/LetsEncryptClientTest.kt +++ b/android-test/src/androidTest/java/okhttp/android/test/letsencrypt/LetsEncryptClientTest.kt @@ -22,12 +22,14 @@ import okhttp3.Request import okhttp3.tls.HandshakeCertificates import okhttp3.tls.decodeCertificatePem import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import java.security.cert.X509Certificate /** * Test for new Let's Encrypt Root Certificate. */ +@Tag("Remote") class LetsEncryptClientTest { @Test fun get() { // These tests wont actually run before Android 8.0 as per diff --git a/mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.java b/mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.java index c9fefe8ed..c43feeb5f 100644 --- a/mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.java +++ b/mockwebserver-deprecated/src/test/java/okhttp3/mockwebserver/MockWebServerTest.java @@ -44,6 +44,7 @@ import okhttp3.tls.HeldCertificate; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.extension.RegisterExtension; @@ -63,6 +64,7 @@ import static org.junit.Assume.assumeFalse; @SuppressWarnings({"ArraysAsListWithZeroOrOneArgument", "deprecation"}) @Timeout(30) +@Tag("Slow") public final class MockWebServerTest { @RegisterExtension public PlatformRule platform = new PlatformRule(); diff --git a/mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.java b/mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.java index aaa534f9f..1d5e5497a 100644 --- a/mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.java +++ b/mockwebserver/src/test/java/mockwebserver3/MockWebServerTest.java @@ -43,6 +43,7 @@ import okhttp3.tls.HeldCertificate; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.extension.RegisterExtension; @@ -60,6 +61,7 @@ import static org.junit.jupiter.api.Assumptions.assumeFalse; @SuppressWarnings({"ArraysAsListWithZeroOrOneArgument", "deprecation"}) @Timeout(30) +@Tag("Slow") public final class MockWebServerTest { @RegisterExtension public PlatformRule platform = new PlatformRule(); diff --git a/native-image-tests/src/main/kotlin/okhttp3/SampleTest.kt b/native-image-tests/src/main/kotlin/okhttp3/SampleTest.kt index 96d68c2cf..39c11a32c 100644 --- a/native-image-tests/src/main/kotlin/okhttp3/SampleTest.kt +++ b/native-image-tests/src/main/kotlin/okhttp3/SampleTest.kt @@ -28,8 +28,8 @@ class SampleTest { @JvmField @RegisterExtension val clientRule = OkHttpClientTestRule() @Test - fun failingTest() { - assertThat("hello").isEqualTo("goodbye") + fun passingTest() { + assertThat("hello").isEqualTo("hello") } @Test diff --git a/okhttp-dnsoverhttps/src/test/java/okhttp3/dnsoverhttps/DnsOverHttpsTest.java b/okhttp-dnsoverhttps/src/test/java/okhttp3/dnsoverhttps/DnsOverHttpsTest.java index 5d5c56b6b..4be9eba82 100644 --- a/okhttp-dnsoverhttps/src/test/java/okhttp3/dnsoverhttps/DnsOverHttpsTest.java +++ b/okhttp-dnsoverhttps/src/test/java/okhttp3/dnsoverhttps/DnsOverHttpsTest.java @@ -36,6 +36,7 @@ import okhttp3.testing.PlatformRule; import okio.Buffer; import okio.ByteString; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.RegisterExtension; @@ -46,6 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; @ExtendWith(MockWebServerExtension.class) +@Tag("Slowish") public class DnsOverHttpsTest { @RegisterExtension public final PlatformRule platform = new PlatformRule(); diff --git a/okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceHttpTest.java b/okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceHttpTest.java index aff634e42..24ec9f93b 100644 --- a/okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceHttpTest.java +++ b/okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceHttpTest.java @@ -28,6 +28,7 @@ import okhttp3.sse.EventSources; import okhttp3.testing.PlatformRule; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.RegisterExtension; @@ -35,6 +36,7 @@ import org.junit.jupiter.api.extension.RegisterExtension; import static org.assertj.core.api.Assertions.assertThat; @ExtendWith(MockWebServerExtension.class) +@Tag("Slowish") public final class EventSourceHttpTest { @RegisterExtension public final PlatformRule platform = new PlatformRule(); diff --git a/okhttp/src/test/java/okhttp3/CacheTest.java b/okhttp/src/test/java/okhttp3/CacheTest.java index cc88d3383..addeae6ca 100644 --- a/okhttp/src/test/java/okhttp3/CacheTest.java +++ b/okhttp/src/test/java/okhttp3/CacheTest.java @@ -49,6 +49,7 @@ import okio.GzipSink; import okio.Okio; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -59,6 +60,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.data.Offset.offset; import static org.junit.jupiter.api.Assertions.fail; +@Tag("Slow") public final class CacheTest { private static final HostnameVerifier NULL_HOSTNAME_VERIFIER = (name, session) -> true; diff --git a/okhttp/src/test/java/okhttp3/CallTest.java b/okhttp/src/test/java/okhttp3/CallTest.java index aff2965b7..171e7255d 100644 --- a/okhttp/src/test/java/okhttp3/CallTest.java +++ b/okhttp/src/test/java/okhttp3/CallTest.java @@ -83,6 +83,7 @@ import okio.Okio; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.extension.RegisterExtension; @@ -2215,6 +2216,7 @@ public final class CallTest { assertThat(server.takeRequest().getSequenceNumber()).isEqualTo(2); } + @Tag("Slow") @Test public void follow20Redirects() throws Exception { for (int i = 0; i < 20; i++) { server.enqueue(new MockResponse() @@ -2229,6 +2231,7 @@ public final class CallTest { .assertBody("Success!"); } + @Tag("Slow") @Test public void follow20Redirects_Async() throws Exception { for (int i = 0; i < 20; i++) { server.enqueue(new MockResponse() @@ -2245,6 +2248,7 @@ public final class CallTest { .assertBody("Success!"); } + @Tag("Slow") @Test public void doesNotFollow21Redirects() throws Exception { for (int i = 0; i < 21; i++) { server.enqueue(new MockResponse() @@ -2261,6 +2265,7 @@ public final class CallTest { } } + @Tag("Slow") @Test public void doesNotFollow21Redirects_Async() throws Exception { for (int i = 0; i < 21; i++) { server.enqueue(new MockResponse() @@ -2323,10 +2328,12 @@ public final class CallTest { assertThat(server.getRequestCount()).isEqualTo(0); } + @Tag("Slowish") @Test public void cancelDuringHttpConnect() throws Exception { cancelDuringConnect("http"); } + @Tag("Slowish") @Test public void cancelDuringHttpsConnect() throws Exception { cancelDuringConnect("https"); } @@ -2768,6 +2775,7 @@ public final class CallTest { expect100ContinueEmptyRequestBody(); } + @Tag("Slowish") @Test public void expect100ContinueTimesOutWithoutContinue() throws Exception { server.enqueue(new MockResponse() .setSocketPolicy(SocketPolicy.NO_RESPONSE)); @@ -2793,6 +2801,7 @@ public final class CallTest { assertThat(recordedRequest.getBody().readUtf8()).isEqualTo(""); } + @Tag("Slowish") @Test public void expect100ContinueTimesOutWithoutContinue_HTTP2() throws Exception { enableProtocol(Protocol.HTTP_2); expect100ContinueTimesOutWithoutContinue(); @@ -2820,6 +2829,7 @@ public final class CallTest { serverRespondsWithUnsolicited100Continue(); } + @Tag("Slow") @Test public void serverRespondsWith100ContinueOnly() throws Exception { client = client.newBuilder() .readTimeout(Duration.ofSeconds(1)) @@ -2844,6 +2854,7 @@ public final class CallTest { assertThat(recordedRequest.getBody().readUtf8()).isEqualTo("abc"); } + @Tag("Slow") @Test public void serverRespondsWith100ContinueOnly_HTTP2() throws Exception { enableProtocol(Protocol.HTTP_2); serverRespondsWith100ContinueOnly(); @@ -2867,11 +2878,13 @@ public final class CallTest { assertThat(server.takeRequest().getSequenceNumber()).isEqualTo(1); } + @Tag("Slow") @Test public void successfulExpectContinuePermitsConnectionReuseWithHttp2() throws Exception { enableProtocol(Protocol.HTTP_2); successfulExpectContinuePermitsConnectionReuse(); } + @Tag("Slow") @Test public void unsuccessfulExpectContinuePreventsConnectionReuse() throws Exception { server.enqueue(new MockResponse()); server.enqueue(new MockResponse()); @@ -3604,6 +3617,7 @@ public final class CallTest { + " Did you forget to close a response body?"); } + @Tag("Slowish") @Test public void asyncLeakedResponseBodyLogsStackTrace() throws Exception { server.enqueue(new MockResponse() .setBody("This gets leaked.")); diff --git a/okhttp/src/test/java/okhttp3/ConnectionCoalescingTest.java b/okhttp/src/test/java/okhttp3/ConnectionCoalescingTest.java index caec25046..5557bae3c 100644 --- a/okhttp/src/test/java/okhttp3/ConnectionCoalescingTest.java +++ b/okhttp/src/test/java/okhttp3/ConnectionCoalescingTest.java @@ -34,6 +34,7 @@ import okhttp3.testing.PlatformRule; import okhttp3.tls.HandshakeCertificates; import okhttp3.tls.HeldCertificate; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -41,6 +42,7 @@ import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; +@Tag("Slowish") public final class ConnectionCoalescingTest { @RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); diff --git a/okhttp/src/test/java/okhttp3/ConnectionReuseTest.java b/okhttp/src/test/java/okhttp3/ConnectionReuseTest.java index 1797ad554..82e0b28c8 100644 --- a/okhttp/src/test/java/okhttp3/ConnectionReuseTest.java +++ b/okhttp/src/test/java/okhttp3/ConnectionReuseTest.java @@ -25,6 +25,7 @@ import mockwebserver3.SocketPolicy; import okhttp3.testing.PlatformRule; import okhttp3.tls.HandshakeCertificates; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.extension.RegisterExtension; @@ -36,6 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; @Timeout(30) +@Tag("Slowish") public final class ConnectionReuseTest { @RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); diff --git a/okhttp/src/test/java/okhttp3/DispatcherTest.java b/okhttp/src/test/java/okhttp3/DispatcherTest.java index f9d0003f0..ed380c859 100644 --- a/okhttp/src/test/java/okhttp3/DispatcherTest.java +++ b/okhttp/src/test/java/okhttp3/DispatcherTest.java @@ -5,6 +5,7 @@ import java.io.InterruptedIOException; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -12,6 +13,7 @@ import static java.util.concurrent.TimeUnit.SECONDS; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; +@Tag("Slowish") public final class DispatcherTest { @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); diff --git a/okhttp/src/test/java/okhttp3/DuplexTest.java b/okhttp/src/test/java/okhttp3/DuplexTest.java index d685ea15e..64b094bbd 100644 --- a/okhttp/src/test/java/okhttp3/DuplexTest.java +++ b/okhttp/src/test/java/okhttp3/DuplexTest.java @@ -37,6 +37,7 @@ import okio.BufferedSource; import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.extension.RegisterExtension; @@ -48,6 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; @Timeout(30) +@Tag("Slowish") public final class DuplexTest { @RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); diff --git a/okhttp/src/test/java/okhttp3/EventListenerTest.java b/okhttp/src/test/java/okhttp3/EventListenerTest.java index c9eb67203..a7ba75b83 100644 --- a/okhttp/src/test/java/okhttp3/EventListenerTest.java +++ b/okhttp/src/test/java/okhttp3/EventListenerTest.java @@ -69,6 +69,7 @@ import org.hamcrest.Matcher; import org.junit.Assert; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.extension.RegisterExtension; @@ -83,6 +84,7 @@ import static org.junit.Assume.assumeThat; @Flaky // STDOUT logging enabled for test @Timeout(30) +@Tag("Slow") public final class EventListenerTest { public static final Matcher anyResponse = CoreMatchers.any(Response.class); diff --git a/okhttp/src/test/java/okhttp3/InterceptorTest.java b/okhttp/src/test/java/okhttp3/InterceptorTest.java index f8df3e03d..599370f7f 100644 --- a/okhttp/src/test/java/okhttp3/InterceptorTest.java +++ b/okhttp/src/test/java/okhttp3/InterceptorTest.java @@ -41,12 +41,14 @@ import okio.Okio; import okio.Sink; import okio.Source; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; +@Tag("Slow") public final class InterceptorTest { @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); diff --git a/okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt b/okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt index 1da7ead64..40e3f1ca6 100644 --- a/okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt +++ b/okhttp/src/test/java/okhttp3/KotlinSourceModernTest.kt @@ -76,6 +76,8 @@ import okio.BufferedSink import okio.BufferedSource import okio.ByteString import okio.Timeout +import org.junit.jupiter.api.Assumptions.assumeFalse +import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test @@ -95,6 +97,11 @@ import org.junit.jupiter.api.Test ) @Disabled class KotlinSourceModernTest { + @BeforeEach + fun disabled() { + assumeFalse(true) + } + @Test fun address() { val address: Address = newAddress() diff --git a/okhttp/src/test/java/okhttp3/MultipartReaderTest.kt b/okhttp/src/test/java/okhttp3/MultipartReaderTest.kt index 383185924..94d2ee525 100644 --- a/okhttp/src/test/java/okhttp3/MultipartReaderTest.kt +++ b/okhttp/src/test/java/okhttp3/MultipartReaderTest.kt @@ -15,8 +15,6 @@ */ package okhttp3 -import java.io.EOFException -import java.net.ProtocolException import okhttp3.Headers.Companion.headersOf import okhttp3.MediaType.Companion.toMediaType import okhttp3.RequestBody.Companion.toRequestBody @@ -24,8 +22,12 @@ import okhttp3.ResponseBody.Companion.toResponseBody import okio.Buffer import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.fail +import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test +import java.io.EOFException +import java.net.ProtocolException +@Tag("Slowish") class MultipartReaderTest { @Test fun `parse multipart`() { val multipart = """ @@ -47,23 +49,27 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) assertThat(parts.boundary).isEqualTo("simple boundary") val partAbc = parts.nextPart()!! - assertThat(partAbc.headers).isEqualTo(headersOf( + assertThat(partAbc.headers).isEqualTo( + headersOf( "Content-Type", "text/plain; charset=utf-8", "Content-ID", "abc" - )) + ) + ) assertThat(partAbc.body.readUtf8()).isEqualTo("abcd\r\nefgh") val partIjk = parts.nextPart()!! - assertThat(partIjk.headers).isEqualTo(headersOf( + assertThat(partIjk.headers).isEqualTo( + headersOf( "Content-Type", "text/plain; charset=utf-8", "Content-ID", "ijk" - )) + ) + ) assertThat(partIjk.body.readUtf8()).isEqualTo("ijkl\r\nmnop\r\n") assertThat(parts.nextPart()).isNull() @@ -79,7 +85,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val responseBody = multipart.toResponseBody( - "application/multipart; boundary=\"simple boundary\"".toMediaType()) + "application/multipart; boundary=\"simple boundary\"".toMediaType() + ) val parts = MultipartReader(responseBody) assertThat(parts.boundary).isEqualTo("simple boundary") @@ -100,8 +107,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) val part = parts.nextPart()!! @@ -126,8 +133,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) try { @@ -151,8 +158,8 @@ class MultipartReaderTest { .replace(Regex("(?m)abcd\r\n"), "abcd\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) val part = parts.nextPart()!! @@ -174,8 +181,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) val part = parts.nextPart()!! @@ -199,8 +206,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) parts.nextPart()!! @@ -225,8 +232,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) val partAbc = parts.nextPart()!! @@ -253,8 +260,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) val part = parts.nextPart()!! @@ -270,8 +277,8 @@ class MultipartReaderTest { @Test fun `cannot call nextPart after calling close`() { val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer() + boundary = "simple boundary", + source = Buffer() ) parts.close() @@ -291,8 +298,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) try { @@ -315,8 +322,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) val part = parts.nextPart()!! @@ -337,8 +344,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) val part = parts.nextPart()!! @@ -359,8 +366,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) val part = parts.nextPart()!! @@ -381,8 +388,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) val part = parts.nextPart()!! @@ -400,8 +407,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) try { @@ -422,8 +429,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) parts.nextPart() @@ -451,8 +458,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "-", - source = Buffer().writeUtf8(multipart) + boundary = "-", + source = Buffer().writeUtf8(multipart) ) val partAbc = parts.nextPart()!! @@ -479,8 +486,8 @@ class MultipartReaderTest { .replace("\n", "\r\n") val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer().writeUtf8(multipart) + boundary = "simple boundary", + source = Buffer().writeUtf8(multipart) ) assertThat(parts.nextPart()).isNotNull() @@ -490,8 +497,8 @@ class MultipartReaderTest { @Test fun `empty source`() { val parts = MultipartReader( - boundary = "simple boundary", - source = Buffer() + boundary = "simple boundary", + source = Buffer() ) try { @@ -516,24 +523,30 @@ class MultipartReaderTest { val reader = MultipartReader(bodyContent, "boundary") val quickPart = reader.nextPart()!! - assertThat(quickPart.headers).isEqualTo(headersOf( + assertThat(quickPart.headers).isEqualTo( + headersOf( "Content-Type", "text/plain; charset=utf-8", "Content-Length", "5" - )) + ) + ) assertThat(quickPart.body.readUtf8()).isEqualTo("Quick") val brownPart = reader.nextPart()!! - assertThat(brownPart.headers).isEqualTo(headersOf( + assertThat(brownPart.headers).isEqualTo( + headersOf( "Content-Disposition", "form-data; name=\"color\"", "Content-Length", "5" - )) + ) + ) assertThat(brownPart.body.readUtf8()).isEqualTo("Brown") val foxPart = reader.nextPart()!! - assertThat(foxPart.headers).isEqualTo(headersOf( + assertThat(foxPart.headers).isEqualTo( + headersOf( "Content-Disposition", "form-data; name=\"animal\"; filename=\"fox.txt\"", "Content-Length", "3" - )) + ) + ) assertThat(foxPart.body.readUtf8()).isEqualTo("Fox") assertThat(reader.nextPart()).isNull() diff --git a/okhttp/src/test/java/okhttp3/ServerTruncatesRequestTest.kt b/okhttp/src/test/java/okhttp3/ServerTruncatesRequestTest.kt index 97bb5d1f1..c1bbfc324 100644 --- a/okhttp/src/test/java/okhttp3/ServerTruncatesRequestTest.kt +++ b/okhttp/src/test/java/okhttp3/ServerTruncatesRequestTest.kt @@ -27,12 +27,14 @@ import okio.BufferedSink import okio.IOException import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.Timeout import org.junit.jupiter.api.extension.RegisterExtension import org.junit.jupiter.api.fail @Timeout(30) +@Tag("Slowish") class ServerTruncatesRequestTest( val server: MockWebServer ) { @@ -63,14 +65,16 @@ class ServerTruncatesRequestTest( private fun serverTruncatesRequestOnLongPost(https: Boolean) { server.enqueue(MockResponse() - .setSocketPolicy(SocketPolicy.DO_NOT_READ_REQUEST_BODY) - .setBody("abc") - .apply { this.http2ErrorCode = ErrorCode.NO_ERROR.httpCode }) + .setSocketPolicy(SocketPolicy.DO_NOT_READ_REQUEST_BODY) + .setBody("abc") + .apply { this.http2ErrorCode = ErrorCode.NO_ERROR.httpCode }) - val call = client.newCall(Request.Builder() + val call = client.newCall( + Request.Builder() .url(server.url("/")) .post(SlowRequestBody) - .build()) + .build() + ) call.execute().use { response -> assertThat(response.body!!.string()).isEqualTo("abc") @@ -115,16 +119,18 @@ class ServerTruncatesRequestTest( enableProtocol(Protocol.HTTP_2) server.enqueue(MockResponse() - .setSocketPolicy(SocketPolicy.DO_NOT_READ_REQUEST_BODY) - .setBody("abc") - .apply { this.http2ErrorCode = ErrorCode.NO_ERROR.httpCode }) + .setSocketPolicy(SocketPolicy.DO_NOT_READ_REQUEST_BODY) + .setBody("abc") + .apply { this.http2ErrorCode = ErrorCode.NO_ERROR.httpCode }) val requestBody = AsyncRequestBody() - val call = client.newCall(Request.Builder() + val call = client.newCall( + Request.Builder() .url(server.url("/")) .post(requestBody) - .build()) + .build() + ) call.execute().use { response -> assertThat(response.body!!.string()).isEqualTo("abc") @@ -171,10 +177,12 @@ class ServerTruncatesRequestTest( server.enqueue(mockResponse) - val call = client.newCall(Request.Builder() + val call = client.newCall( + Request.Builder() .url(server.url("/")) .post(SlowRequestBody) - .build()) + .build() + ) call.execute().use { response -> assertThat(response.body!!.string()).isEqualTo("abc") @@ -193,10 +201,12 @@ class ServerTruncatesRequestTest( } } - val callA = client.newCall(Request.Builder() + val callA = client.newCall( + Request.Builder() .url(server.url("/")) .post(requestBody) - .build()) + .build() + ) try { callA.execute() @@ -209,9 +219,11 @@ class ServerTruncatesRequestTest( // Confirm that the connection pool was not corrupted by making another call. This doesn't use // makeSimpleCall() because it uses the MockResponse enqueued above. - val callB = client.newCall(Request.Builder() + val callB = client.newCall( + Request.Builder() .url(server.url("/")) - .build()) + .build() + ) callB.execute().use { response -> assertThat(response.body!!.string()).isEqualTo("abc") } @@ -219,9 +231,11 @@ class ServerTruncatesRequestTest( private fun makeSimpleCall() { server.enqueue(MockResponse().setBody("healthy")) - val callB = client.newCall(Request.Builder() + val callB = client.newCall( + Request.Builder() .url(server.url("/")) - .build()) + .build() + ) callB.execute().use { response -> assertThat(response.body!!.string()).isEqualTo("healthy") } @@ -238,8 +252,8 @@ class ServerTruncatesRequestTest( private fun enableTls() { client = client.newBuilder() .sslSocketFactory( - handshakeCertificates.sslSocketFactory(), - handshakeCertificates.trustManager + handshakeCertificates.sslSocketFactory(), + handshakeCertificates.trustManager ) .hostnameVerifier(RecordingHostnameVerifier()) .build() diff --git a/okhttp/src/test/java/okhttp3/URLConnectionTest.java b/okhttp/src/test/java/okhttp3/URLConnectionTest.java index e0276f93a..2e2b2898c 100644 --- a/okhttp/src/test/java/okhttp3/URLConnectionTest.java +++ b/okhttp/src/test/java/okhttp3/URLConnectionTest.java @@ -81,6 +81,7 @@ import okio.Utf8; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.io.TempDir; @@ -110,6 +111,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; /** Android's URLConnectionTest, ported to exercise OkHttp's Call API. */ +@Tag("Slow") public final class URLConnectionTest { @RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); diff --git a/okhttp/src/test/java/okhttp3/WholeOperationTimeoutTest.java b/okhttp/src/test/java/okhttp3/WholeOperationTimeoutTest.java index db8b1a5aa..69a813e4d 100644 --- a/okhttp/src/test/java/okhttp3/WholeOperationTimeoutTest.java +++ b/okhttp/src/test/java/okhttp3/WholeOperationTimeoutTest.java @@ -27,6 +27,7 @@ import mockwebserver3.MockWebServer; import okhttp3.testing.Flaky; import okio.BufferedSink; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.extension.RegisterExtension; @@ -35,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; @Timeout(30) +@Tag("Slow") public final class WholeOperationTimeoutTest { /** A large response body. Smaller bodies might successfully read after the socket is closed! */ private static final String BIG_ENOUGH_BODY = TestUtil.repeat('a', 64 * 1024); diff --git a/okhttp/src/test/java/okhttp3/internal/cache/DiskLruCacheTest.kt b/okhttp/src/test/java/okhttp3/internal/cache/DiskLruCacheTest.kt index fc9ca0c20..98f807790 100644 --- a/okhttp/src/test/java/okhttp3/internal/cache/DiskLruCacheTest.kt +++ b/okhttp/src/test/java/okhttp3/internal/cache/DiskLruCacheTest.kt @@ -29,6 +29,7 @@ import okio.buffer import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.Assumptions +import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Timeout import org.junit.jupiter.api.fail import org.junit.jupiter.api.io.TempDir @@ -49,6 +50,7 @@ class FileSystemParamProvider: SimpleProvider() { } @Timeout(60) +@Tag("Slow") class DiskLruCacheTest { private lateinit var fileSystem: FaultyFileSystem private var windows: Boolean = false @@ -492,7 +494,7 @@ class DiskLruCacheTest { writeFile(getCleanFile("k1", 1), "B") fileSystem.sink(journalFile).buffer().use { it.writeUtf8( - """ + """ |${DiskLruCache.MAGIC} |${DiskLruCache.VERSION_1} |100 @@ -1058,7 +1060,7 @@ class DiskLruCacheTest { // Cause the rebuild action to fail. fileSystem.setFaultyRename( - File(cacheDir, DiskLruCache.JOURNAL_FILE_BACKUP), true + File(cacheDir, DiskLruCache.JOURNAL_FILE_BACKUP), true ) taskFaker.runNextTask() @@ -1959,7 +1961,8 @@ class DiskLruCacheTest { creator.commit() val snapshotAfterCommit = cache.snapshots() assertThat(snapshotAfterCommit.hasNext()).withFailMessage( - "Entry has been removed during creation.").isTrue() + "Entry has been removed during creation." + ).isTrue() } @ParameterizedTest @@ -2158,13 +2161,14 @@ class DiskLruCacheTest { private fun assertJournalEquals(vararg expectedBodyLines: String) { assertThat(readJournalLines()).isEqualTo( - listOf(DiskLruCache.MAGIC, DiskLruCache.VERSION_1, "100", "2", "") + expectedBodyLines) + listOf(DiskLruCache.MAGIC, DiskLruCache.VERSION_1, "100", "2", "") + expectedBodyLines + ) } private fun createJournal(vararg bodyLines: String) { createJournalWithHeader( - DiskLruCache.MAGIC, - DiskLruCache.VERSION_1, "100", "2", "", *bodyLines + DiskLruCache.MAGIC, + DiskLruCache.VERSION_1, "100", "2", "", *bodyLines ) } @@ -2177,7 +2181,8 @@ class DiskLruCacheTest { vararg bodyLines: String ) { fileSystem.sink(journalFile).buffer().use { sink -> - sink.writeUtf8(""" + sink.writeUtf8( + """ |$magic |$version |$appVersion diff --git a/okhttp/src/test/java/okhttp3/internal/cache2/RelayTest.java b/okhttp/src/test/java/okhttp3/internal/cache2/RelayTest.java index 2691b9116..6944be145 100644 --- a/okhttp/src/test/java/okhttp3/internal/cache2/RelayTest.java +++ b/okhttp/src/test/java/okhttp3/internal/cache2/RelayTest.java @@ -30,12 +30,14 @@ import okio.Pipe; import okio.Source; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; +@Tag("Slowish") public final class RelayTest { @TempDir File tempDir; private ExecutorService executor = Executors.newCachedThreadPool(); diff --git a/okhttp/src/test/java/okhttp3/internal/concurrent/TaskRunnerRealBackendTest.kt b/okhttp/src/test/java/okhttp3/internal/concurrent/TaskRunnerRealBackendTest.kt index ac8c18495..d58db5d60 100644 --- a/okhttp/src/test/java/okhttp3/internal/concurrent/TaskRunnerRealBackendTest.kt +++ b/okhttp/src/test/java/okhttp3/internal/concurrent/TaskRunnerRealBackendTest.kt @@ -22,6 +22,7 @@ import java.util.concurrent.TimeUnit import org.assertj.core.api.Assertions.assertThat import org.assertj.core.data.Offset import org.junit.jupiter.api.AfterEach +import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test /** @@ -31,6 +32,7 @@ import org.junit.jupiter.api.Test * This test is doing real sleeping with tolerances of 250 ms. Hopefully that's enough for even the * busiest of CI servers. */ +@Tag("Slowish") class TaskRunnerRealBackendTest { private val log = LinkedBlockingDeque() diff --git a/okhttp/src/test/java/okhttp3/internal/http/CancelTest.kt b/okhttp/src/test/java/okhttp3/internal/http/CancelTest.kt index a990451dc..c29216465 100644 --- a/okhttp/src/test/java/okhttp3/internal/http/CancelTest.kt +++ b/okhttp/src/test/java/okhttp3/internal/http/CancelTest.kt @@ -49,6 +49,7 @@ import okio.Buffer import okio.BufferedSink import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Timeout import org.junit.jupiter.api.extension.RegisterExtension import org.junit.jupiter.api.fail @@ -62,6 +63,7 @@ import javax.net.ServerSocketFactory import javax.net.SocketFactory @Timeout(30) +@Tag("Slow") class CancelTest { @JvmField @RegisterExtension val platform = PlatformRule() @@ -125,7 +127,9 @@ class CancelTest { return socket } }) - .sslSocketFactory(handshakeCertificates.sslSocketFactory(), handshakeCertificates.trustManager) + .sslSocketFactory( + handshakeCertificates.sslSocketFactory(), handshakeCertificates.trustManager + ) .eventListener(listener) .apply { if (connectionType == HTTPS) { protocols(listOf(HTTP_1_1)) } @@ -140,25 +144,25 @@ class CancelTest { setUp(mode) server.enqueue(MockResponse()) val call = client.newCall( - Request.Builder() - .url(server.url("/")) - .post(object : RequestBody() { - override fun contentType(): MediaType? { - return null - } + Request.Builder() + .url(server.url("/")) + .post(object : RequestBody() { + override fun contentType(): MediaType? { + return null + } - @Throws( - IOException::class - ) override fun writeTo(sink: BufferedSink) { - for (i in 0..9) { - sink.writeByte(0) - sink.flush() - sleep(100) - } - fail("Expected connection to be closed") - } - }) - .build() + @Throws( + IOException::class + ) override fun writeTo(sink: BufferedSink) { + for (i in 0..9) { + sink.writeByte(0) + sink.flush() + sleep(100) + } + fail("Expected connection to be closed") + } + }) + .build() ) cancelLater(call, 500) try { @@ -175,17 +179,17 @@ class CancelTest { setUp(mode) val responseBodySize = 8 * 1024 * 1024 // 8 MiB. server.enqueue( - MockResponse() - .setBody( - Buffer() - .write(ByteArray(responseBodySize)) - ) - .throttleBody(64 * 1024, 125, MILLISECONDS) + MockResponse() + .setBody( + Buffer() + .write(ByteArray(responseBodySize)) + ) + .throttleBody(64 * 1024, 125, MILLISECONDS) ) // 500 Kbps val call = client.newCall( - Request.Builder() - .url(server.url("/")) - .build() + Request.Builder() + .url(server.url("/")) + .build() ) val response = call.execute() cancelLater(call, 500) @@ -208,12 +212,12 @@ class CancelTest { setUp(mode) val responseBodySize = 8 * 1024 * 1024 // 8 MiB. server.enqueue( - MockResponse() - .setBody( - Buffer() - .write(ByteArray(responseBodySize)) - ) - .throttleBody(64 * 1024, 125, MILLISECONDS) + MockResponse() + .setBody( + Buffer() + .write(ByteArray(responseBodySize)) + ) + .throttleBody(64 * 1024, 125, MILLISECONDS) ) // 500 Kbps server.enqueue(MockResponse().apply { setResponseCode(200) @@ -305,5 +309,7 @@ class CancelTest { } class CancelModelParamProvider: SimpleProvider() { - override fun arguments() = CancelTest.CancelMode.values().flatMap { c -> CancelTest.ConnectionType.values().map { x -> Pair(c, x) } } + override fun arguments() = CancelTest.CancelMode.values().flatMap { c -> CancelTest.ConnectionType.values().map { x -> Pair( + c, x + ) } } } diff --git a/okhttp/src/test/java/okhttp3/internal/http/ThreadInterruptTest.java b/okhttp/src/test/java/okhttp3/internal/http/ThreadInterruptTest.java index 42d765633..d440035c8 100644 --- a/okhttp/src/test/java/okhttp3/internal/http/ThreadInterruptTest.java +++ b/okhttp/src/test/java/okhttp3/internal/http/ThreadInterruptTest.java @@ -39,11 +39,13 @@ import okio.Buffer; import okio.BufferedSink; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import static org.junit.jupiter.api.Assertions.fail; +@Tag("Slowish") public final class ThreadInterruptTest { @RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); diff --git a/okhttp/src/test/java/okhttp3/internal/http2/Http2ConnectionTest.java b/okhttp/src/test/java/okhttp3/internal/http2/Http2ConnectionTest.java index 15677b2fa..746e7feef 100644 --- a/okhttp/src/test/java/okhttp3/internal/http2/Http2ConnectionTest.java +++ b/okhttp/src/test/java/okhttp3/internal/http2/Http2ConnectionTest.java @@ -39,6 +39,7 @@ import okio.Okio; import okio.Sink; import okio.Source; import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; @@ -64,6 +65,7 @@ import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.fail; @Timeout(5) +@Tag("Slow") public final class Http2ConnectionTest { private final MockHttp2Peer peer = new MockHttp2Peer(); diff --git a/okhttp/src/test/java/okhttp3/internal/http2/HttpOverHttp2Test.java b/okhttp/src/test/java/okhttp3/internal/http2/HttpOverHttp2Test.java index eba233a7d..0c7d00d5f 100644 --- a/okhttp/src/test/java/okhttp3/internal/http2/HttpOverHttp2Test.java +++ b/okhttp/src/test/java/okhttp3/internal/http2/HttpOverHttp2Test.java @@ -75,6 +75,7 @@ import okio.GzipSink; import okio.Okio; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.io.TempDir; @@ -96,6 +97,7 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue; /** Test how HTTP/2 interacts with HTTP features. */ @Timeout(60) @Flaky +@Tag("Slow") public final class HttpOverHttp2Test { // Flaky https://github.com/square/okhttp/issues/4632 // Flaky https://github.com/square/okhttp/issues/4633 diff --git a/okhttp/src/test/java/okhttp3/internal/http2/SettingsTest.java b/okhttp/src/test/java/okhttp3/internal/http2/SettingsTest.java index 55cbfc3c1..93274c297 100644 --- a/okhttp/src/test/java/okhttp3/internal/http2/SettingsTest.java +++ b/okhttp/src/test/java/okhttp3/internal/http2/SettingsTest.java @@ -15,7 +15,7 @@ */ package okhttp3.internal.http2; -import org.junit.Test; +import org.junit.jupiter.api.Test; import static okhttp3.internal.http2.Settings.DEFAULT_INITIAL_WINDOW_SIZE; import static okhttp3.internal.http2.Settings.MAX_CONCURRENT_STREAMS; diff --git a/okhttp/src/test/java/okhttp3/internal/tls/ClientAuthTest.java b/okhttp/src/test/java/okhttp3/internal/tls/ClientAuthTest.java index 01bb4b241..1e6429b46 100644 --- a/okhttp/src/test/java/okhttp3/internal/tls/ClientAuthTest.java +++ b/okhttp/src/test/java/okhttp3/internal/tls/ClientAuthTest.java @@ -47,6 +47,7 @@ import okhttp3.testing.PlatformVersion; import okhttp3.tls.HandshakeCertificates; import okhttp3.tls.HeldCertificate; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.RegisterExtension; @@ -58,6 +59,7 @@ import static okhttp3.tls.internal.TlsUtil.newTrustManager; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; +@Tag("Slowish") @ExtendWith(MockWebServerExtension.class) public final class ClientAuthTest { @RegisterExtension public final PlatformRule platform = new PlatformRule(); diff --git a/okhttp/src/test/java/okhttp3/internal/ws/RealWebSocketTest.java b/okhttp/src/test/java/okhttp3/internal/ws/RealWebSocketTest.java index 5868f45ca..317055412 100644 --- a/okhttp/src/test/java/okhttp3/internal/ws/RealWebSocketTest.java +++ b/okhttp/src/test/java/okhttp3/internal/ws/RealWebSocketTest.java @@ -33,6 +33,7 @@ import okio.Pipe; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import static okhttp3.internal.ws.RealWebSocket.DEFAULT_MINIMUM_DEFLATE_SIZE; @@ -40,6 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.data.Offset.offset; import static org.junit.jupiter.api.Assertions.fail; +@Tag("Slow") public final class RealWebSocketTest { // NOTE: Fields are named 'client' and 'server' for cognitive simplicity. This differentiation has // zero effect on the behavior of the WebSocket API which is why tests are only written once diff --git a/okhttp/src/test/java/okhttp3/internal/ws/WebSocketHttpTest.java b/okhttp/src/test/java/okhttp3/internal/ws/WebSocketHttpTest.java index b8e0888d7..f7ed3777b 100644 --- a/okhttp/src/test/java/okhttp3/internal/ws/WebSocketHttpTest.java +++ b/okhttp/src/test/java/okhttp3/internal/ws/WebSocketHttpTest.java @@ -51,6 +51,7 @@ import okio.ByteString; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -62,6 +63,7 @@ import static org.assertj.core.data.Offset.offset; import static org.junit.jupiter.api.Assertions.fail; @Flaky +@Tag("Slow") public final class WebSocketHttpTest { // Flaky https://github.com/square/okhttp/issues/4515 // Flaky https://github.com/square/okhttp/issues/4953 diff --git a/okhttp/src/test/java/okhttp3/osgi/OsgiTest.java b/okhttp/src/test/java/okhttp3/osgi/OsgiTest.java index 79e1dfc65..60bb09259 100644 --- a/okhttp/src/test/java/okhttp3/osgi/OsgiTest.java +++ b/okhttp/src/test/java/okhttp3/osgi/OsgiTest.java @@ -32,8 +32,10 @@ import java.util.stream.Collectors; import okio.BufferedSource; import okio.Okio; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; +@Tag("Slow") public final class OsgiTest { /** Each is the Bundle-SymbolicName of an OkHttp module's OSGi configuration. */ private static final List REQUIRED_BUNDLES = Arrays.asList( diff --git a/samples/guide/src/test/kotlin/okhttp3/AllMainsTest.kt b/samples/guide/src/test/kotlin/okhttp3/AllMainsTest.kt index fa2a4e49b..f08e24e32 100644 --- a/samples/guide/src/test/kotlin/okhttp3/AllMainsTest.kt +++ b/samples/guide/src/test/kotlin/okhttp3/AllMainsTest.kt @@ -16,6 +16,7 @@ package okhttp3 import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.Tag import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File @@ -50,6 +51,7 @@ internal class MainTestProvider : SimpleProvider() { } @Disabled("Don't run by default") +@Tag("Slow") class AllMainsTest { @ParameterizedTest @ArgumentsSource(MainTestProvider::class)