Fix issue #52.

This commit is contained in:
Charles Moulliard
2017-05-18 15:21:38 +02:00
parent 209976a502
commit 6a6c77d7ff
5 changed files with 33 additions and 11 deletions

View File

@@ -14,8 +14,8 @@
<name>Spring Cloud Kubernetes :: Dependencies</name>
<description>Spring Cloud Kubernetes Dependencies</description>
<properties>
<arquillian.version>1.1.12.Final</arquillian.version>
<arquillian-cube.version>1.0.0.Alpha20</arquillian-cube.version>
<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>
<restassured.version>3.0.2</restassured.version>

View File

@@ -38,12 +38,15 @@ curl http://IP_OR_HOSTNAME/
## Integration test
To deploy the replication controller, create the pod & access its service on Kubernetes, we will use the Arquillian Kubernetes Cube framework.
It will use the yaml configuration file generated by the Fabric8 maven plugin in order to talk to the platform toi create the different objects;replication controller,
pod, service ...
When the service becomes available, the unit test which is a HTTP Client will call the endpoint to verify that it receives as reponse message "Hello World"
To deploy the resources required on Kubernetes/OpenShift and to test if the service deployed can answer to requests, we will use the [Arquillian Kubernetes Cube](https://github.com/arquillian/arquillian-cube/blob/master/docs/kubernetes.adoc) framework.
This testing framework uses the Kubernetes Java API to communicate with the platform, deploy the resources (pod, service, deployment, ...) generated by the Fabric8 maven plugin.
When the service becomes available, the method defines within thr Junit test will call the endpoint to verify that it receives as response the string
`Hello World`
To play with the integration test, execute the following maven command:
Remark : If you run the integration test against OpenShift, create first the namespace/project `it` that arquillian will use to deploy the resources using the oc client
`oc new-project it`.
When you are logged to the OpenShift platform, execute the following maven command to run the Integration Test against OpenShift
```
mvn clean install -Pintegration

View File

@@ -71,6 +71,11 @@
<artifactId>arquillian-cube-kubernetes</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.arquillian.cube</groupId>
<artifactId>arquillian-cube-openshift</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -188,7 +193,6 @@
<id>fmp</id>
<goals>
<goal>resource</goal>
<goal>helm</goal>
<goal>build</goal>
</goals>
</execution>

View File

@@ -4,6 +4,10 @@
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<extension qualifier="kubernetes">
<extension qualifier="openshift">
<property name="namespace.use.existing">it</property>
<!-- <property name="wait.timeout">600000</property>-->
<property name="env.config.resource.name">openshift.yml</property>
<property name="namespace.cleanup.enabled">true</property>
</extension>
</arquillian>

View File

@@ -1,5 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<include resource="org/springframework/boot/logging/logback/base.xml" />
<logger name="org.hibernate.validator" level="info" /> <!-- Validator prints a lot of debug messages for Arquillian Cube -->
</configuration>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>