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

This commit is contained in:
Ryan Baxter
2019-03-04 15:46:41 -05:00
14 changed files with 24 additions and 73 deletions

View File

@@ -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 {

View File

@@ -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 {
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);

View File

@@ -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

View File

@@ -1,5 +1,4 @@
test:
hostport: httpbin.org:80
uri: lb:https://testservice
server:
@@ -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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,4 @@
test:
hostport: httpbin.org:80
uri: lb:https://testservice
server:
@@ -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

View File

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

View File

@@ -5,6 +5,9 @@ test:
uri: lb://testservice
spring:
profiles:
include: logging
cloud:
gateway:
globalcors:
@@ -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:
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