1
0
mirror of https://github.com/square/okhttp.git synced 2025-08-01 16:06:56 +03:00

Launcher for quick tests (#6437)

This commit is contained in:
Yuri Schimke
2020-11-21 13:28:45 +00:00
committed by GitHub
parent ec1d18d143
commit 083315a473
34 changed files with 242 additions and 116 deletions

View File

@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Not Slow" type="JUnit" factoryName="JUnit" singleton="false">
<useClassPathOnly />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="tags" />
<option name="VM_PARAMETERS" value="-ea -Djunit.jupiter.extensions.autodetection.enabled=true" />
<option name="PARAMETERS" value="" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
<tag value="!Slow &amp; !Slowish &amp; !Remote &amp; !Android" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -60,6 +60,7 @@ import org.junit.jupiter.api.Assertions.fail
import org.junit.jupiter.api.Assumptions.assumeTrue import org.junit.jupiter.api.Assumptions.assumeTrue
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith import org.junit.jupiter.api.extension.ExtendWith
import org.junit.jupiter.api.extension.RegisterExtension 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. * Run with "./gradlew :android-test:connectedCheck" and make sure ANDROID_SDK_ROOT is set.
*/ */
@ExtendWith(MockWebServerExtension::class) @ExtendWith(MockWebServerExtension::class)
@Tag("Slow")
class OkHttpTest(val server: MockWebServer) { class OkHttpTest(val server: MockWebServer) {
@Suppress("RedundantVisibilityModifier") @Suppress("RedundantVisibilityModifier")
@JvmField @JvmField

View File

@ -22,12 +22,14 @@ import okhttp3.Request
import okhttp3.tls.HandshakeCertificates import okhttp3.tls.HandshakeCertificates
import okhttp3.tls.decodeCertificatePem import okhttp3.tls.decodeCertificatePem
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import java.security.cert.X509Certificate import java.security.cert.X509Certificate
/** /**
* Test for new Let's Encrypt Root Certificate. * Test for new Let's Encrypt Root Certificate.
*/ */
@Tag("Remote")
class LetsEncryptClientTest { class LetsEncryptClientTest {
@Test fun get() { @Test fun get() {
// These tests wont actually run before Android 8.0 as per // These tests wont actually run before Android 8.0 as per

View File

@ -44,6 +44,7 @@ import okhttp3.tls.HeldCertificate;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
@ -63,6 +64,7 @@ import static org.junit.Assume.assumeFalse;
@SuppressWarnings({"ArraysAsListWithZeroOrOneArgument", "deprecation"}) @SuppressWarnings({"ArraysAsListWithZeroOrOneArgument", "deprecation"})
@Timeout(30) @Timeout(30)
@Tag("Slow")
public final class MockWebServerTest { public final class MockWebServerTest {
@RegisterExtension public PlatformRule platform = new PlatformRule(); @RegisterExtension public PlatformRule platform = new PlatformRule();

View File

@ -43,6 +43,7 @@ import okhttp3.tls.HeldCertificate;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
@ -60,6 +61,7 @@ import static org.junit.jupiter.api.Assumptions.assumeFalse;
@SuppressWarnings({"ArraysAsListWithZeroOrOneArgument", "deprecation"}) @SuppressWarnings({"ArraysAsListWithZeroOrOneArgument", "deprecation"})
@Timeout(30) @Timeout(30)
@Tag("Slow")
public final class MockWebServerTest { public final class MockWebServerTest {
@RegisterExtension public PlatformRule platform = new PlatformRule(); @RegisterExtension public PlatformRule platform = new PlatformRule();

View File

@ -28,8 +28,8 @@ class SampleTest {
@JvmField @RegisterExtension val clientRule = OkHttpClientTestRule() @JvmField @RegisterExtension val clientRule = OkHttpClientTestRule()
@Test @Test
fun failingTest() { fun passingTest() {
assertThat("hello").isEqualTo("goodbye") assertThat("hello").isEqualTo("hello")
} }
@Test @Test

View File

@ -36,6 +36,7 @@ import okhttp3.testing.PlatformRule;
import okio.Buffer; import okio.Buffer;
import okio.ByteString; import okio.ByteString;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.RegisterExtension; 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; import static org.junit.jupiter.api.Assertions.fail;
@ExtendWith(MockWebServerExtension.class) @ExtendWith(MockWebServerExtension.class)
@Tag("Slowish")
public class DnsOverHttpsTest { public class DnsOverHttpsTest {
@RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final PlatformRule platform = new PlatformRule();

View File

@ -28,6 +28,7 @@ import okhttp3.sse.EventSources;
import okhttp3.testing.PlatformRule; import okhttp3.testing.PlatformRule;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.RegisterExtension; 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; import static org.assertj.core.api.Assertions.assertThat;
@ExtendWith(MockWebServerExtension.class) @ExtendWith(MockWebServerExtension.class)
@Tag("Slowish")
public final class EventSourceHttpTest { public final class EventSourceHttpTest {
@RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final PlatformRule platform = new PlatformRule();

View File

@ -49,6 +49,7 @@ import okio.GzipSink;
import okio.Okio; import okio.Okio;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension; 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.assertj.core.data.Offset.offset;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@Tag("Slow")
public final class CacheTest { public final class CacheTest {
private static final HostnameVerifier NULL_HOSTNAME_VERIFIER = (name, session) -> true; private static final HostnameVerifier NULL_HOSTNAME_VERIFIER = (name, session) -> true;

View File

@ -83,6 +83,7 @@ import okio.Okio;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
@ -2215,6 +2216,7 @@ public final class CallTest {
assertThat(server.takeRequest().getSequenceNumber()).isEqualTo(2); assertThat(server.takeRequest().getSequenceNumber()).isEqualTo(2);
} }
@Tag("Slow")
@Test public void follow20Redirects() throws Exception { @Test public void follow20Redirects() throws Exception {
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
server.enqueue(new MockResponse() server.enqueue(new MockResponse()
@ -2229,6 +2231,7 @@ public final class CallTest {
.assertBody("Success!"); .assertBody("Success!");
} }
@Tag("Slow")
@Test public void follow20Redirects_Async() throws Exception { @Test public void follow20Redirects_Async() throws Exception {
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
server.enqueue(new MockResponse() server.enqueue(new MockResponse()
@ -2245,6 +2248,7 @@ public final class CallTest {
.assertBody("Success!"); .assertBody("Success!");
} }
@Tag("Slow")
@Test public void doesNotFollow21Redirects() throws Exception { @Test public void doesNotFollow21Redirects() throws Exception {
for (int i = 0; i < 21; i++) { for (int i = 0; i < 21; i++) {
server.enqueue(new MockResponse() server.enqueue(new MockResponse()
@ -2261,6 +2265,7 @@ public final class CallTest {
} }
} }
@Tag("Slow")
@Test public void doesNotFollow21Redirects_Async() throws Exception { @Test public void doesNotFollow21Redirects_Async() throws Exception {
for (int i = 0; i < 21; i++) { for (int i = 0; i < 21; i++) {
server.enqueue(new MockResponse() server.enqueue(new MockResponse()
@ -2323,10 +2328,12 @@ public final class CallTest {
assertThat(server.getRequestCount()).isEqualTo(0); assertThat(server.getRequestCount()).isEqualTo(0);
} }
@Tag("Slowish")
@Test public void cancelDuringHttpConnect() throws Exception { @Test public void cancelDuringHttpConnect() throws Exception {
cancelDuringConnect("http"); cancelDuringConnect("http");
} }
@Tag("Slowish")
@Test public void cancelDuringHttpsConnect() throws Exception { @Test public void cancelDuringHttpsConnect() throws Exception {
cancelDuringConnect("https"); cancelDuringConnect("https");
} }
@ -2768,6 +2775,7 @@ public final class CallTest {
expect100ContinueEmptyRequestBody(); expect100ContinueEmptyRequestBody();
} }
@Tag("Slowish")
@Test public void expect100ContinueTimesOutWithoutContinue() throws Exception { @Test public void expect100ContinueTimesOutWithoutContinue() throws Exception {
server.enqueue(new MockResponse() server.enqueue(new MockResponse()
.setSocketPolicy(SocketPolicy.NO_RESPONSE)); .setSocketPolicy(SocketPolicy.NO_RESPONSE));
@ -2793,6 +2801,7 @@ public final class CallTest {
assertThat(recordedRequest.getBody().readUtf8()).isEqualTo(""); assertThat(recordedRequest.getBody().readUtf8()).isEqualTo("");
} }
@Tag("Slowish")
@Test public void expect100ContinueTimesOutWithoutContinue_HTTP2() throws Exception { @Test public void expect100ContinueTimesOutWithoutContinue_HTTP2() throws Exception {
enableProtocol(Protocol.HTTP_2); enableProtocol(Protocol.HTTP_2);
expect100ContinueTimesOutWithoutContinue(); expect100ContinueTimesOutWithoutContinue();
@ -2820,6 +2829,7 @@ public final class CallTest {
serverRespondsWithUnsolicited100Continue(); serverRespondsWithUnsolicited100Continue();
} }
@Tag("Slow")
@Test public void serverRespondsWith100ContinueOnly() throws Exception { @Test public void serverRespondsWith100ContinueOnly() throws Exception {
client = client.newBuilder() client = client.newBuilder()
.readTimeout(Duration.ofSeconds(1)) .readTimeout(Duration.ofSeconds(1))
@ -2844,6 +2854,7 @@ public final class CallTest {
assertThat(recordedRequest.getBody().readUtf8()).isEqualTo("abc"); assertThat(recordedRequest.getBody().readUtf8()).isEqualTo("abc");
} }
@Tag("Slow")
@Test public void serverRespondsWith100ContinueOnly_HTTP2() throws Exception { @Test public void serverRespondsWith100ContinueOnly_HTTP2() throws Exception {
enableProtocol(Protocol.HTTP_2); enableProtocol(Protocol.HTTP_2);
serverRespondsWith100ContinueOnly(); serverRespondsWith100ContinueOnly();
@ -2867,11 +2878,13 @@ public final class CallTest {
assertThat(server.takeRequest().getSequenceNumber()).isEqualTo(1); assertThat(server.takeRequest().getSequenceNumber()).isEqualTo(1);
} }
@Tag("Slow")
@Test public void successfulExpectContinuePermitsConnectionReuseWithHttp2() throws Exception { @Test public void successfulExpectContinuePermitsConnectionReuseWithHttp2() throws Exception {
enableProtocol(Protocol.HTTP_2); enableProtocol(Protocol.HTTP_2);
successfulExpectContinuePermitsConnectionReuse(); successfulExpectContinuePermitsConnectionReuse();
} }
@Tag("Slow")
@Test public void unsuccessfulExpectContinuePreventsConnectionReuse() throws Exception { @Test public void unsuccessfulExpectContinuePreventsConnectionReuse() throws Exception {
server.enqueue(new MockResponse()); server.enqueue(new MockResponse());
server.enqueue(new MockResponse()); server.enqueue(new MockResponse());
@ -3604,6 +3617,7 @@ public final class CallTest {
+ " Did you forget to close a response body?"); + " Did you forget to close a response body?");
} }
@Tag("Slowish")
@Test public void asyncLeakedResponseBodyLogsStackTrace() throws Exception { @Test public void asyncLeakedResponseBodyLogsStackTrace() throws Exception {
server.enqueue(new MockResponse() server.enqueue(new MockResponse()
.setBody("This gets leaked.")); .setBody("This gets leaked."));

View File

@ -34,6 +34,7 @@ import okhttp3.testing.PlatformRule;
import okhttp3.tls.HandshakeCertificates; import okhttp3.tls.HandshakeCertificates;
import okhttp3.tls.HeldCertificate; import okhttp3.tls.HeldCertificate;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension; 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.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@Tag("Slowish")
public final class ConnectionCoalescingTest { public final class ConnectionCoalescingTest {
@RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final PlatformRule platform = new PlatformRule();
@RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule();

View File

@ -25,6 +25,7 @@ import mockwebserver3.SocketPolicy;
import okhttp3.testing.PlatformRule; import okhttp3.testing.PlatformRule;
import okhttp3.tls.HandshakeCertificates; import okhttp3.tls.HandshakeCertificates;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension; 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; import static org.junit.jupiter.api.Assertions.fail;
@Timeout(30) @Timeout(30)
@Tag("Slowish")
public final class ConnectionReuseTest { public final class ConnectionReuseTest {
@RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final PlatformRule platform = new PlatformRule();
@RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule();

View File

@ -5,6 +5,7 @@ import java.io.InterruptedIOException;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension; 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.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@Tag("Slowish")
public final class DispatcherTest { public final class DispatcherTest {
@RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule();

View File

@ -37,6 +37,7 @@ import okio.BufferedSource;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension; 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; import static org.junit.jupiter.api.Assertions.fail;
@Timeout(30) @Timeout(30)
@Tag("Slowish")
public final class DuplexTest { public final class DuplexTest {
@RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final PlatformRule platform = new PlatformRule();
@RegisterExtension public OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); @RegisterExtension public OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule();

View File

@ -69,6 +69,7 @@ import org.hamcrest.Matcher;
import org.junit.Assert; import org.junit.Assert;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
@ -83,6 +84,7 @@ import static org.junit.Assume.assumeThat;
@Flaky // STDOUT logging enabled for test @Flaky // STDOUT logging enabled for test
@Timeout(30) @Timeout(30)
@Tag("Slow")
public final class EventListenerTest { public final class EventListenerTest {
public static final Matcher<Response> anyResponse = CoreMatchers.any(Response.class); public static final Matcher<Response> anyResponse = CoreMatchers.any(Response.class);

View File

@ -41,12 +41,14 @@ import okio.Okio;
import okio.Sink; import okio.Sink;
import okio.Source; import okio.Source;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@Tag("Slow")
public final class InterceptorTest { public final class InterceptorTest {
@RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule();

View File

@ -76,6 +76,8 @@ import okio.BufferedSink
import okio.BufferedSource import okio.BufferedSource
import okio.ByteString import okio.ByteString
import okio.Timeout 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.Disabled
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
@ -95,6 +97,11 @@ import org.junit.jupiter.api.Test
) )
@Disabled @Disabled
class KotlinSourceModernTest { class KotlinSourceModernTest {
@BeforeEach
fun disabled() {
assumeFalse(true)
}
@Test @Test
fun address() { fun address() {
val address: Address = newAddress() val address: Address = newAddress()

View File

@ -15,8 +15,6 @@
*/ */
package okhttp3 package okhttp3
import java.io.EOFException
import java.net.ProtocolException
import okhttp3.Headers.Companion.headersOf import okhttp3.Headers.Companion.headersOf
import okhttp3.MediaType.Companion.toMediaType import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.RequestBody.Companion.toRequestBody
@ -24,8 +22,12 @@ import okhttp3.ResponseBody.Companion.toResponseBody
import okio.Buffer import okio.Buffer
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Assertions.fail import org.junit.jupiter.api.Assertions.fail
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import java.io.EOFException
import java.net.ProtocolException
@Tag("Slowish")
class MultipartReaderTest { class MultipartReaderTest {
@Test fun `parse multipart`() { @Test fun `parse multipart`() {
val multipart = """ val multipart = """
@ -53,17 +55,21 @@ class MultipartReaderTest {
assertThat(parts.boundary).isEqualTo("simple boundary") assertThat(parts.boundary).isEqualTo("simple boundary")
val partAbc = parts.nextPart()!! val partAbc = parts.nextPart()!!
assertThat(partAbc.headers).isEqualTo(headersOf( assertThat(partAbc.headers).isEqualTo(
headersOf(
"Content-Type", "text/plain; charset=utf-8", "Content-Type", "text/plain; charset=utf-8",
"Content-ID", "abc" "Content-ID", "abc"
)) )
)
assertThat(partAbc.body.readUtf8()).isEqualTo("abcd\r\nefgh") assertThat(partAbc.body.readUtf8()).isEqualTo("abcd\r\nefgh")
val partIjk = parts.nextPart()!! val partIjk = parts.nextPart()!!
assertThat(partIjk.headers).isEqualTo(headersOf( assertThat(partIjk.headers).isEqualTo(
headersOf(
"Content-Type", "text/plain; charset=utf-8", "Content-Type", "text/plain; charset=utf-8",
"Content-ID", "ijk" "Content-ID", "ijk"
)) )
)
assertThat(partIjk.body.readUtf8()).isEqualTo("ijkl\r\nmnop\r\n") assertThat(partIjk.body.readUtf8()).isEqualTo("ijkl\r\nmnop\r\n")
assertThat(parts.nextPart()).isNull() assertThat(parts.nextPart()).isNull()
@ -79,7 +85,8 @@ class MultipartReaderTest {
.replace("\n", "\r\n") .replace("\n", "\r\n")
val responseBody = multipart.toResponseBody( val responseBody = multipart.toResponseBody(
"application/multipart; boundary=\"simple boundary\"".toMediaType()) "application/multipart; boundary=\"simple boundary\"".toMediaType()
)
val parts = MultipartReader(responseBody) val parts = MultipartReader(responseBody)
assertThat(parts.boundary).isEqualTo("simple boundary") assertThat(parts.boundary).isEqualTo("simple boundary")
@ -516,24 +523,30 @@ class MultipartReaderTest {
val reader = MultipartReader(bodyContent, "boundary") val reader = MultipartReader(bodyContent, "boundary")
val quickPart = reader.nextPart()!! val quickPart = reader.nextPart()!!
assertThat(quickPart.headers).isEqualTo(headersOf( assertThat(quickPart.headers).isEqualTo(
headersOf(
"Content-Type", "text/plain; charset=utf-8", "Content-Type", "text/plain; charset=utf-8",
"Content-Length", "5" "Content-Length", "5"
)) )
)
assertThat(quickPart.body.readUtf8()).isEqualTo("Quick") assertThat(quickPart.body.readUtf8()).isEqualTo("Quick")
val brownPart = reader.nextPart()!! val brownPart = reader.nextPart()!!
assertThat(brownPart.headers).isEqualTo(headersOf( assertThat(brownPart.headers).isEqualTo(
headersOf(
"Content-Disposition", "form-data; name=\"color\"", "Content-Disposition", "form-data; name=\"color\"",
"Content-Length", "5" "Content-Length", "5"
)) )
)
assertThat(brownPart.body.readUtf8()).isEqualTo("Brown") assertThat(brownPart.body.readUtf8()).isEqualTo("Brown")
val foxPart = reader.nextPart()!! val foxPart = reader.nextPart()!!
assertThat(foxPart.headers).isEqualTo(headersOf( assertThat(foxPart.headers).isEqualTo(
headersOf(
"Content-Disposition", "form-data; name=\"animal\"; filename=\"fox.txt\"", "Content-Disposition", "form-data; name=\"animal\"; filename=\"fox.txt\"",
"Content-Length", "3" "Content-Length", "3"
)) )
)
assertThat(foxPart.body.readUtf8()).isEqualTo("Fox") assertThat(foxPart.body.readUtf8()).isEqualTo("Fox")
assertThat(reader.nextPart()).isNull() assertThat(reader.nextPart()).isNull()

View File

@ -27,12 +27,14 @@ import okio.BufferedSink
import okio.IOException import okio.IOException
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Timeout import org.junit.jupiter.api.Timeout
import org.junit.jupiter.api.extension.RegisterExtension import org.junit.jupiter.api.extension.RegisterExtension
import org.junit.jupiter.api.fail import org.junit.jupiter.api.fail
@Timeout(30) @Timeout(30)
@Tag("Slowish")
class ServerTruncatesRequestTest( class ServerTruncatesRequestTest(
val server: MockWebServer val server: MockWebServer
) { ) {
@ -67,10 +69,12 @@ class ServerTruncatesRequestTest(
.setBody("abc") .setBody("abc")
.apply { this.http2ErrorCode = ErrorCode.NO_ERROR.httpCode }) .apply { this.http2ErrorCode = ErrorCode.NO_ERROR.httpCode })
val call = client.newCall(Request.Builder() val call = client.newCall(
Request.Builder()
.url(server.url("/")) .url(server.url("/"))
.post(SlowRequestBody) .post(SlowRequestBody)
.build()) .build()
)
call.execute().use { response -> call.execute().use { response ->
assertThat(response.body!!.string()).isEqualTo("abc") assertThat(response.body!!.string()).isEqualTo("abc")
@ -121,10 +125,12 @@ class ServerTruncatesRequestTest(
val requestBody = AsyncRequestBody() val requestBody = AsyncRequestBody()
val call = client.newCall(Request.Builder() val call = client.newCall(
Request.Builder()
.url(server.url("/")) .url(server.url("/"))
.post(requestBody) .post(requestBody)
.build()) .build()
)
call.execute().use { response -> call.execute().use { response ->
assertThat(response.body!!.string()).isEqualTo("abc") assertThat(response.body!!.string()).isEqualTo("abc")
@ -171,10 +177,12 @@ class ServerTruncatesRequestTest(
server.enqueue(mockResponse) server.enqueue(mockResponse)
val call = client.newCall(Request.Builder() val call = client.newCall(
Request.Builder()
.url(server.url("/")) .url(server.url("/"))
.post(SlowRequestBody) .post(SlowRequestBody)
.build()) .build()
)
call.execute().use { response -> call.execute().use { response ->
assertThat(response.body!!.string()).isEqualTo("abc") 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("/")) .url(server.url("/"))
.post(requestBody) .post(requestBody)
.build()) .build()
)
try { try {
callA.execute() callA.execute()
@ -209,9 +219,11 @@ class ServerTruncatesRequestTest(
// Confirm that the connection pool was not corrupted by making another call. This doesn't use // Confirm that the connection pool was not corrupted by making another call. This doesn't use
// makeSimpleCall() because it uses the MockResponse enqueued above. // makeSimpleCall() because it uses the MockResponse enqueued above.
val callB = client.newCall(Request.Builder() val callB = client.newCall(
Request.Builder()
.url(server.url("/")) .url(server.url("/"))
.build()) .build()
)
callB.execute().use { response -> callB.execute().use { response ->
assertThat(response.body!!.string()).isEqualTo("abc") assertThat(response.body!!.string()).isEqualTo("abc")
} }
@ -219,9 +231,11 @@ class ServerTruncatesRequestTest(
private fun makeSimpleCall() { private fun makeSimpleCall() {
server.enqueue(MockResponse().setBody("healthy")) server.enqueue(MockResponse().setBody("healthy"))
val callB = client.newCall(Request.Builder() val callB = client.newCall(
Request.Builder()
.url(server.url("/")) .url(server.url("/"))
.build()) .build()
)
callB.execute().use { response -> callB.execute().use { response ->
assertThat(response.body!!.string()).isEqualTo("healthy") assertThat(response.body!!.string()).isEqualTo("healthy")
} }

View File

@ -81,6 +81,7 @@ import okio.Utf8;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.api.io.TempDir; 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; import static org.junit.jupiter.api.Assertions.fail;
/** Android's URLConnectionTest, ported to exercise OkHttp's Call API. */ /** Android's URLConnectionTest, ported to exercise OkHttp's Call API. */
@Tag("Slow")
public final class URLConnectionTest { public final class URLConnectionTest {
@RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final PlatformRule platform = new PlatformRule();
@RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule();

View File

@ -27,6 +27,7 @@ import mockwebserver3.MockWebServer;
import okhttp3.testing.Flaky; import okhttp3.testing.Flaky;
import okio.BufferedSink; import okio.BufferedSink;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension; 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; import static org.junit.jupiter.api.Assertions.fail;
@Timeout(30) @Timeout(30)
@Tag("Slow")
public final class WholeOperationTimeoutTest { public final class WholeOperationTimeoutTest {
/** A large response body. Smaller bodies might successfully read after the socket is closed! */ /** 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); private static final String BIG_ENOUGH_BODY = TestUtil.repeat('a', 64 * 1024);

View File

@ -29,6 +29,7 @@ import okio.buffer
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Assumptions import org.junit.jupiter.api.Assumptions
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Timeout import org.junit.jupiter.api.Timeout
import org.junit.jupiter.api.fail import org.junit.jupiter.api.fail
import org.junit.jupiter.api.io.TempDir import org.junit.jupiter.api.io.TempDir
@ -49,6 +50,7 @@ class FileSystemParamProvider: SimpleProvider() {
} }
@Timeout(60) @Timeout(60)
@Tag("Slow")
class DiskLruCacheTest { class DiskLruCacheTest {
private lateinit var fileSystem: FaultyFileSystem private lateinit var fileSystem: FaultyFileSystem
private var windows: Boolean = false private var windows: Boolean = false
@ -1959,7 +1961,8 @@ class DiskLruCacheTest {
creator.commit() creator.commit()
val snapshotAfterCommit = cache.snapshots() val snapshotAfterCommit = cache.snapshots()
assertThat(snapshotAfterCommit.hasNext()).withFailMessage( assertThat(snapshotAfterCommit.hasNext()).withFailMessage(
"Entry has been removed during creation.").isTrue() "Entry has been removed during creation."
).isTrue()
} }
@ParameterizedTest @ParameterizedTest
@ -2158,7 +2161,8 @@ class DiskLruCacheTest {
private fun assertJournalEquals(vararg expectedBodyLines: String) { private fun assertJournalEquals(vararg expectedBodyLines: String) {
assertThat(readJournalLines()).isEqualTo( 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) { private fun createJournal(vararg bodyLines: String) {
@ -2177,7 +2181,8 @@ class DiskLruCacheTest {
vararg bodyLines: String vararg bodyLines: String
) { ) {
fileSystem.sink(journalFile).buffer().use { sink -> fileSystem.sink(journalFile).buffer().use { sink ->
sink.writeUtf8(""" sink.writeUtf8(
"""
|$magic |$magic
|$version |$version
|$appVersion |$appVersion

View File

@ -30,12 +30,14 @@ import okio.Pipe;
import okio.Source; import okio.Source;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.io.TempDir;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@Tag("Slowish")
public final class RelayTest { public final class RelayTest {
@TempDir File tempDir; @TempDir File tempDir;
private ExecutorService executor = Executors.newCachedThreadPool(); private ExecutorService executor = Executors.newCachedThreadPool();

View File

@ -22,6 +22,7 @@ import java.util.concurrent.TimeUnit
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.data.Offset import org.assertj.core.data.Offset
import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test 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 * This test is doing real sleeping with tolerances of 250 ms. Hopefully that's enough for even the
* busiest of CI servers. * busiest of CI servers.
*/ */
@Tag("Slowish")
class TaskRunnerRealBackendTest { class TaskRunnerRealBackendTest {
private val log = LinkedBlockingDeque<String>() private val log = LinkedBlockingDeque<String>()

View File

@ -49,6 +49,7 @@ import okio.Buffer
import okio.BufferedSink import okio.BufferedSink
import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Timeout import org.junit.jupiter.api.Timeout
import org.junit.jupiter.api.extension.RegisterExtension import org.junit.jupiter.api.extension.RegisterExtension
import org.junit.jupiter.api.fail import org.junit.jupiter.api.fail
@ -62,6 +63,7 @@ import javax.net.ServerSocketFactory
import javax.net.SocketFactory import javax.net.SocketFactory
@Timeout(30) @Timeout(30)
@Tag("Slow")
class CancelTest { class CancelTest {
@JvmField @RegisterExtension val platform = PlatformRule() @JvmField @RegisterExtension val platform = PlatformRule()
@ -125,7 +127,9 @@ class CancelTest {
return socket return socket
} }
}) })
.sslSocketFactory(handshakeCertificates.sslSocketFactory(), handshakeCertificates.trustManager) .sslSocketFactory(
handshakeCertificates.sslSocketFactory(), handshakeCertificates.trustManager
)
.eventListener(listener) .eventListener(listener)
.apply { .apply {
if (connectionType == HTTPS) { protocols(listOf(HTTP_1_1)) } if (connectionType == HTTPS) { protocols(listOf(HTTP_1_1)) }
@ -305,5 +309,7 @@ class CancelTest {
} }
class CancelModelParamProvider: SimpleProvider() { 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
) } }
} }

View File

@ -39,11 +39,13 @@ import okio.Buffer;
import okio.BufferedSink; import okio.BufferedSink;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@Tag("Slowish")
public final class ThreadInterruptTest { public final class ThreadInterruptTest {
@RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final PlatformRule platform = new PlatformRule();
@RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule(); @RegisterExtension public final OkHttpClientTestRule clientTestRule = new OkHttpClientTestRule();

View File

@ -39,6 +39,7 @@ import okio.Okio;
import okio.Sink; import okio.Sink;
import okio.Source; import okio.Source;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout; 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; import static org.junit.jupiter.api.Assertions.fail;
@Timeout(5) @Timeout(5)
@Tag("Slow")
public final class Http2ConnectionTest { public final class Http2ConnectionTest {
private final MockHttp2Peer peer = new MockHttp2Peer(); private final MockHttp2Peer peer = new MockHttp2Peer();

View File

@ -75,6 +75,7 @@ import okio.GzipSink;
import okio.Okio; import okio.Okio;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.api.io.TempDir; 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. */ /** Test how HTTP/2 interacts with HTTP features. */
@Timeout(60) @Timeout(60)
@Flaky @Flaky
@Tag("Slow")
public final class HttpOverHttp2Test { public final class HttpOverHttp2Test {
// Flaky https://github.com/square/okhttp/issues/4632 // Flaky https://github.com/square/okhttp/issues/4632
// Flaky https://github.com/square/okhttp/issues/4633 // Flaky https://github.com/square/okhttp/issues/4633

View File

@ -15,7 +15,7 @@
*/ */
package okhttp3.internal.http2; 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.DEFAULT_INITIAL_WINDOW_SIZE;
import static okhttp3.internal.http2.Settings.MAX_CONCURRENT_STREAMS; import static okhttp3.internal.http2.Settings.MAX_CONCURRENT_STREAMS;

View File

@ -47,6 +47,7 @@ import okhttp3.testing.PlatformVersion;
import okhttp3.tls.HandshakeCertificates; import okhttp3.tls.HandshakeCertificates;
import okhttp3.tls.HeldCertificate; import okhttp3.tls.HeldCertificate;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.RegisterExtension; 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.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@Tag("Slowish")
@ExtendWith(MockWebServerExtension.class) @ExtendWith(MockWebServerExtension.class)
public final class ClientAuthTest { public final class ClientAuthTest {
@RegisterExtension public final PlatformRule platform = new PlatformRule(); @RegisterExtension public final PlatformRule platform = new PlatformRule();

View File

@ -33,6 +33,7 @@ import okio.Pipe;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static okhttp3.internal.ws.RealWebSocket.DEFAULT_MINIMUM_DEFLATE_SIZE; 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.assertj.core.data.Offset.offset;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@Tag("Slow")
public final class RealWebSocketTest { public final class RealWebSocketTest {
// NOTE: Fields are named 'client' and 'server' for cognitive simplicity. This differentiation has // 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 // zero effect on the behavior of the WebSocket API which is why tests are only written once

View File

@ -51,6 +51,7 @@ import okio.ByteString;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension; 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; import static org.junit.jupiter.api.Assertions.fail;
@Flaky @Flaky
@Tag("Slow")
public final class WebSocketHttpTest { public final class WebSocketHttpTest {
// Flaky https://github.com/square/okhttp/issues/4515 // Flaky https://github.com/square/okhttp/issues/4515
// Flaky https://github.com/square/okhttp/issues/4953 // Flaky https://github.com/square/okhttp/issues/4953

View File

@ -32,8 +32,10 @@ import java.util.stream.Collectors;
import okio.BufferedSource; import okio.BufferedSource;
import okio.Okio; import okio.Okio;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@Tag("Slow")
public final class OsgiTest { public final class OsgiTest {
/** Each is the Bundle-SymbolicName of an OkHttp module's OSGi configuration. */ /** Each is the Bundle-SymbolicName of an OkHttp module's OSGi configuration. */
private static final List<String> REQUIRED_BUNDLES = Arrays.asList( private static final List<String> REQUIRED_BUNDLES = Arrays.asList(

View File

@ -16,6 +16,7 @@
package okhttp3 package okhttp3
import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Tag
import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.ArgumentsSource import org.junit.jupiter.params.provider.ArgumentsSource
import java.io.File import java.io.File
@ -50,6 +51,7 @@ internal class MainTestProvider : SimpleProvider() {
} }
@Disabled("Don't run by default") @Disabled("Don't run by default")
@Tag("Slow")
class AllMainsTest { class AllMainsTest {
@ParameterizedTest @ParameterizedTest
@ArgumentsSource(MainTestProvider::class) @ArgumentsSource(MainTestProvider::class)