JAVA-22208 Fix port to 1030,1031 for jenkins (#15100)

This commit is contained in:
Anastasios Ioannidis 2023-11-06 17:38:16 +02:00 committed by GitHub
parent 81be7c4ad5
commit 9e3c735879
6 changed files with 12 additions and 31 deletions

View File

@ -63,12 +63,12 @@ class LoadBalancerBooksClientIntegrationTest {
String serviceId = "books-service";
RoundRobinLoadBalancer loadBalancer = new RoundRobinLoadBalancer(ServiceInstanceListSuppliers
.toProvider(serviceId, instance(serviceId, "localhost", false), instance(serviceId, "localhost", true)),
.toProvider(serviceId, instance(serviceId, "localhost", 1030, false), instance(serviceId, "localhost", 1031, true)),
serviceId, -1);
}
private static DefaultServiceInstance instance(String serviceId, String host, boolean secure) {
return new DefaultServiceInstance(serviceId, serviceId, host, 80, secure);
private static DefaultServiceInstance instance(String serviceId, String host, int port, boolean secure) {
return new DefaultServiceInstance(serviceId, serviceId, host, port, secure);
}
@Test

View File

@ -80,13 +80,13 @@ class LoadBalancerIntegrationTest {
void staticConfigurationWorks() {
String serviceId = "test-book-service";
RoundRobinLoadBalancer loadBalancer = new RoundRobinLoadBalancer(ServiceInstanceListSuppliers
.toProvider(serviceId, instance(serviceId, "bookservice1", false), instance(serviceId, "bookservice2", false)),
.toProvider(serviceId, instance(serviceId, "bookservice1", 1030, false), instance(serviceId, "bookservice2", 1031, false)),
serviceId, -1);
assertLoadBalancer(loadBalancer, Arrays.asList("bookservice1", "bookservice2"));
}
private static DefaultServiceInstance instance(String serviceId, String host, boolean secure) {
return new DefaultServiceInstance(serviceId, serviceId, host, 80, secure);
private static DefaultServiceInstance instance(String serviceId, String host, int port, boolean secure) {
return new DefaultServiceInstance(serviceId, serviceId, host, port, secure);
}
@EnableAutoConfiguration

View File

@ -14,11 +14,11 @@ public class TestConfig {
@Bean(initMethod = "start", destroyMethod = "stop")
public WireMockServer mockBooksService() {
return new WireMockServer(options().port(80));
return new WireMockServer(options().port(1030));
}
@Bean(name="secondMockBooksService", initMethod = "start", destroyMethod = "stop")
public WireMockServer secondBooksMockService() {
return new WireMockServer(options().port(81));
return new WireMockServer(options().port(1031));
}
}

View File

@ -11,11 +11,11 @@ public class WireMockConfig {
@Bean(initMethod = "start", destroyMethod = "stop")
public WireMockServer mockBooksService() {
return new WireMockServer(80);
return new WireMockServer(1030);
}
@Bean(initMethod = "start", destroyMethod = "stop")
public WireMockServer mockBooksService2() {
return new WireMockServer(81);
return new WireMockServer(1031);
}
}

View File

@ -1,19 +0,0 @@
eureka:
client:
enabled: false
spring:
application:
name: books-service
cloud:
loadbalancer:
ribbon:
enabled: false
discovery:
client:
simple:
instances:
books-service[0]:
uri: http://localhost:80
books-service[1]:
uri: http://localhost:81

View File

@ -14,6 +14,6 @@ spring:
simple:
instances:
books-service[0]:
uri: http://localhost:80
uri: http://localhost:1030
books-service[1]:
uri: http://localhost:81
uri: http://localhost:1031