Skip to content

Commit 60b8201

Browse files
nebhaleyschimke
authored andcommitted
Slow Test Run Configuration (#512)
Currently the TransportTest#requestChannel2_000_000 test (for all transports) takes a very long time on some systems. It's a useful test to have, but not necessarily to run at all times. This change creates an @slowtest annotation that is meta-annotated so that tests will only be enabled if TEST_SLOW_ENABLED=true has been set. [resolves #511]
1 parent 9f6fbcc commit 60b8201

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2015-2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.rsocket.test;
18+
19+
import java.lang.annotation.Documented;
20+
import java.lang.annotation.ElementType;
21+
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
23+
import java.lang.annotation.Target;
24+
import org.junit.jupiter.api.Test;
25+
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
26+
27+
/**
28+
* {@code @SlowTest} is used to signal that the annotated test class or test method is slow running
29+
* and will be disabled unless enabled via setting the {@code TEST_SLOW_ENABLED} environment
30+
* variable to {@code true}.
31+
*/
32+
@Target({ElementType.TYPE, ElementType.METHOD})
33+
@Retention(RetentionPolicy.RUNTIME)
34+
@Documented
35+
@EnabledIfEnvironmentVariable(named = "TEST_SLOW_ENABLED", matches = "(?i)true")
36+
@Test
37+
public @interface SlowTest {}

rsocket-test/src/main/java/io/rsocket/test/TransportTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ default void requestChannel20_000() {
140140
}
141141

142142
@DisplayName("makes 1 requestChannel request with 2,000,000 payloads")
143-
@Test
143+
@SlowTest
144144
default void requestChannel2_000_000() {
145145
Flux<Payload> payloads = Flux.range(0, 2_000_000).map(this::createTestPayload);
146146

0 commit comments

Comments
 (0)