Browse Source

Merge branch 'Aloren-feature/cleanup-test-configs'

pull/873/head
Ryan Baxter 6 years ago
parent
commit
e7d8a7ad94
  1. 14
      spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/test/BaseWebClientTests.java
  2. 17
      spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/test/ssl/SingleCertSSLTests.java
  3. 8
      spring-cloud-gateway-core/src/test/resources/application-logging.yml
  4. 9
      spring-cloud-gateway-core/src/test/resources/application-multi-cert-ssl.yml
  5. 3
      spring-cloud-gateway-core/src/test/resources/application-redis-rate-limiter-config.yml
  6. 3
      spring-cloud-gateway-core/src/test/resources/application-redis-rate-limiter-default-config.yml
  7. 3
      spring-cloud-gateway-core/src/test/resources/application-remote-address.yml
  8. 1
      spring-cloud-gateway-core/src/test/resources/application-removenonproxyheaders.yml
  9. 4
      spring-cloud-gateway-core/src/test/resources/application-request-header-web-filter.yml
  10. 4
      spring-cloud-gateway-core/src/test/resources/application-request-parameter-web-filter.yml
  11. 4
      spring-cloud-gateway-core/src/test/resources/application-save-session-web-filter.yml
  12. 9
      spring-cloud-gateway-core/src/test/resources/application-single-cert-ssl.yml
  13. 3
      spring-cloud-gateway-core/src/test/resources/application-weights-404.yml
  14. 15
      spring-cloud-gateway-core/src/test/resources/application.yml

14
spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/test/BaseWebClientTests.java

@ -66,18 +66,20 @@ public class BaseWebClientTests { @@ -66,18 +66,20 @@ public class BaseWebClientTests {
@Before
public void setup() {
ClientHttpConnector httpConnector = new ReactorClientHttpConnector();
setup(new ReactorClientHttpConnector(), "http://localhost:" + port);
}
baseUri = "http://localhost:" + port;
protected void setup(ClientHttpConnector httpConnector, String baseUri) {
this.baseUri = baseUri;
this.webClient = WebClient.builder().clientConnector(httpConnector)
.baseUrl(baseUri).build();
this.testClient = WebTestClient.bindToServer().baseUrl(baseUri).build();
.baseUrl(this.baseUri).build();
this.testClient = WebTestClient.bindToServer(httpConnector).baseUrl(this.baseUri)
.build();
}
@Configuration
@RibbonClients({
@RibbonClient(name = "testservice", configuration = TestRibbonConfig.class),
@RibbonClient(name = "myservice", configuration = TestRibbonConfig.class) })
@RibbonClient(name = "testservice", configuration = TestRibbonConfig.class) })
@Import(PermitAllSecurityConfiguration.class)
public static class DefaultTestConfig {

17
spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/test/ssl/SingleCertSSLTests.java

@ -32,15 +32,12 @@ import org.springframework.boot.test.context.SpringBootTest; @@ -32,15 +32,12 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.gateway.test.BaseWebClientTests;
import org.springframework.context.annotation.Import;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.reactive.ClientHttpConnector;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.client.WebClient;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@ -55,16 +52,10 @@ public class SingleCertSSLTests extends BaseWebClientTests { @@ -55,16 +52,10 @@ public class SingleCertSSLTests extends BaseWebClientTests {
try {
SslContext sslContext = SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE).build();
HttpClient httpClient = HttpClient.create().secure(ssl -> {
ssl.sslContext(sslContext);
});
ClientHttpConnector httpConnector = new ReactorClientHttpConnector(
httpClient);
baseUri = "https://localhost:" + port;
this.webClient = WebClient.builder().clientConnector(httpConnector)
.baseUrl(baseUri).build();
this.testClient = WebTestClient.bindToServer(httpConnector).baseUrl(baseUri)
.build();
HttpClient httpClient = HttpClient.create()
.secure(ssl -> ssl.sslContext(sslContext));
setup(new ReactorClientHttpConnector(httpClient),
"https://localhost:" + port);
}
catch (SSLException e) {
throw new RuntimeException(e);

8
spring-cloud-gateway-core/src/test/resources/application-logging.yml

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
logging:
level:
org.springframework.cloud.gateway: TRACE
org.springframework.http.server.reactive: DEBUG
org.springframework.web.reactive: DEBUG
org.springframework.boot.autoconfigure.web: DEBUG
reactor.netty: DEBUG
redisratelimiter: DEBUG

9
spring-cloud-gateway-core/src/test/resources/application-multi-cert-ssl.yml

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
test:
hostport: httpbin.org:80
uri: lb:https://testservice
server:
@ -28,11 +27,3 @@ spring: @@ -28,11 +27,3 @@ spring:
args:
pattern: /**
logging:
level:
org.springframework.cloud.gateway: TRACE
org.springframework.http.server.reactive: DEBUG
org.springframework.web.reactive: DEBUG
reactor.ipc.netty: DEBUG
redisratelimiter: DEBUG

3
spring-cloud-gateway-core/src/test/resources/application-redis-rate-limiter-config.yml

@ -1,6 +1,3 @@ @@ -1,6 +1,3 @@
test:
uri: lb://myservice
spring:
cloud:
gateway:

3
spring-cloud-gateway-core/src/test/resources/application-redis-rate-limiter-default-config.yml

@ -1,6 +1,3 @@ @@ -1,6 +1,3 @@
test:
uri: lb://myservice
spring:
cloud:
gateway:

3
spring-cloud-gateway-core/src/test/resources/application-remote-address.yml

@ -1,6 +1,3 @@ @@ -1,6 +1,3 @@
test:
uri: lb://myservice
spring:
cloud:
gateway:

1
spring-cloud-gateway-core/src/test/resources/application-removenonproxyheaders.yml

@ -7,7 +7,6 @@ spring: @@ -7,7 +7,6 @@ spring:
routes:
# =====================================
- id: remove_request_header_test
# uri: http://httpbin.org:80
uri: lb://testservice
predicates:
- Host=**.removenonproxyheaders.org

4
spring-cloud-gateway-core/src/test/resources/application-request-header-web-filter.yml

@ -1,7 +1,3 @@ @@ -1,7 +1,3 @@
test:
hostport: httpbin.org:80
uri: lb://testservice
spring:
cloud:
gateway:

4
spring-cloud-gateway-core/src/test/resources/application-request-parameter-web-filter.yml

@ -1,7 +1,3 @@ @@ -1,7 +1,3 @@
test:
hostport: httpbin.org:80
uri: lb://testservice
spring:
cloud:
gateway:

4
spring-cloud-gateway-core/src/test/resources/application-save-session-web-filter.yml

@ -1,7 +1,3 @@ @@ -1,7 +1,3 @@
test:
hostport: httpbin.org:80
uri: lb://testservice
spring:
cloud:
gateway:

9
spring-cloud-gateway-core/src/test/resources/application-single-cert-ssl.yml

@ -1,5 +1,4 @@ @@ -1,5 +1,4 @@
test:
hostport: httpbin.org:80
uri: lb:https://testservice
server:
@ -28,11 +27,3 @@ spring: @@ -28,11 +27,3 @@ spring:
args:
pattern: /**
logging:
level:
org.springframework.cloud.gateway: TRACE
org.springframework.http.server.reactive: DEBUG
org.springframework.web.reactive: DEBUG
reactor.ipc.netty: DEBUG
redisratelimiter: DEBUG

3
spring-cloud-gateway-core/src/test/resources/application-weights-404.yml

@ -1,6 +1,3 @@ @@ -1,6 +1,3 @@
test:
uri: lb://testservice
spring:
cloud:
gateway:

15
spring-cloud-gateway-core/src/test/resources/application.yml

@ -5,6 +5,9 @@ test: @@ -5,6 +5,9 @@ test:
uri: lb://testservice
spring:
profiles:
include: logging
cloud:
gateway:
globalcors:
@ -141,7 +144,7 @@ spring: @@ -141,7 +144,7 @@ spring:
# =====================================
- id: load_balancer_client_test
uri: lb://myservice
uri: lb://testservice
predicates:
- Host=**.loadbalancerclient.org
@ -346,17 +349,7 @@ spring: @@ -346,17 +349,7 @@ spring:
hystrix.command.successcmd.execution.isolation.thread.timeoutInMilliseconds: 5000
logging:
level:
org.springframework.cloud.gateway: TRACE
org.springframework.http.server.reactive: DEBUG
org.springframework.web.reactive: DEBUG
org.springframework.boot.autoconfigure.web: DEBUG
reactor.netty: DEBUG
redisratelimiter: DEBUG
eureka:
client:
enabled: false
# port: 8081

Loading…
Cancel
Save