Move version of mockwebserver to dependency pom.xml. Add a system property to define occurences of the mock greeting service as value is different for local vs circleci build
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<arquillian.version>1.1.13.Final</arquillian.version>
|
||||
<arquillian-cube.version>1.3.2</arquillian-cube.version>
|
||||
<kubernetes-client.version>2.2.0</kubernetes-client.version>
|
||||
<mockwebserver.version>0.0.12</mockwebserver.version>
|
||||
<mockwebserver.version>0.0.13</mockwebserver.version>
|
||||
<restassured.version>3.0.2</restassured.version>
|
||||
<spock-spring.version>1.0-groovy-2.3</spock-spring.version>
|
||||
</properties>
|
||||
|
||||
@@ -30,6 +30,11 @@
|
||||
<artifactId>spring-cloud-kubernetes-ribbon</artifactId>
|
||||
<name>Spring Cloud Kubernetes :: Ribbon</name>
|
||||
|
||||
<properties>
|
||||
<!-- Value calculated for Circleci -->
|
||||
<service.occurence>5</service.occurence>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
@@ -120,7 +125,6 @@
|
||||
<dependency>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>mockwebserver</artifactId>
|
||||
<version>0.0.13</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -130,4 +134,19 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>-Dservice</argLine>
|
||||
<systemPropertyVariables>
|
||||
<service.occurence>${service.occurence}</service.occurence>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
@@ -62,6 +63,9 @@ public class RibbonFallbackTest {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(RibbonFallbackTest.class);
|
||||
|
||||
@Value("${service.occurence}")
|
||||
private int SERVICE_OCCURENCE;
|
||||
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
|
||||
@@ -93,7 +97,7 @@ public class RibbonFallbackTest {
|
||||
// to be sure that Ribbon will get the mockendpoint to access it for the call
|
||||
mockServer.expect().get()
|
||||
.withPath("/api/v1/namespaces/testns/endpoints/testapp")
|
||||
.andReturn(200, newEndpoint("testapp-a","testns", mockEndpoint)).times(5);
|
||||
.andReturn(200, newEndpoint("testapp-a","testns", mockEndpoint)).times(SERVICE_OCCURENCE);
|
||||
|
||||
mockEndpoint.expect().get().withPath("/greeting").andReturn(200, "Hello from A").once();
|
||||
String response = restTemplate.getForObject("http://testapp/greeting", String.class);
|
||||
|
||||
Reference in New Issue
Block a user