Skip to content
This repository has been archived by the owner on May 18, 2020. It is now read-only.

Commit

Permalink
Arquillian-cube tests, license header (#7)
Browse files Browse the repository at this point in the history
* Tests using arquillian-cube

* Fail if oc is not configured

* remove comment in readme
  • Loading branch information
pavolloffay committed May 25, 2017
1 parent d8e60a0 commit 173f90f
Show file tree
Hide file tree
Showing 13 changed files with 761 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@

*.jar
!.mvn/wrapper/maven-wrapper.jar
target

Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 1 addition & 0 deletions .mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip
16 changes: 16 additions & 0 deletions .travis.yml
@@ -0,0 +1,16 @@
dist: trusty
sudo: required

language: java
jdk:
- oraclejdk8

cache:
directories:
- $HOME/.m2/repository

script:
- ./mvnw clean test

env:
global:
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -23,3 +23,13 @@ Tracer sometimes fails to resolve Jaeger's address. In such a case run:
sudo iptables -F
```
and restart affected applications.

## Testing
Tests are based on [Arquillian Cube](http://arquillian.org/arquillian-cube/) which require an active connection to
openshift cluster (via `oc`). Currently all templates are tested on minishift or local all-in-one cluster (`oc cluster
up`).

```bash
minishift start // or oc cluster up
mvn clean verify -Pe2e
```
16 changes: 16 additions & 0 deletions all-in-one/jaeger-all-in-one-template.yml
@@ -1,3 +1,17 @@
#
# Copyright 2017 The Jaeger Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
#

# This template uses Jaeger with in-memory storage with limited functionality
# Do not use this in production environment!
#
Expand Down Expand Up @@ -34,6 +48,8 @@ objects:
name: ${JAEGER_NAME}
strategy:
type: Recreate
triggers:
- type: ConfigChange
template:
metadata:
labels:
Expand Down
116 changes: 116 additions & 0 deletions all-in-one/pom.xml
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2017 The Jaeger Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.jaegertracing.openshift</groupId>
<artifactId>jaegertracing-openshift-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<properties>
<rootProject.basedir>${project.basedir}/..</rootProject.basedir>
<template.name>jaeger-all-in-one-template.yml</template.name>
</properties>

<artifactId>jaegertracing-openshift-all-in-one</artifactId>

<dependencies>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-standalone</artifactId>
<version>${version.org.jboss.arquillian}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.arquillian.cube</groupId>
<artifactId>arquillian-cube-requirement</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.arquillian.cube</groupId>
<artifactId>arquillian-cube-openshift</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${version.com.squareup.okhttp3-okhttp}</version>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>e2e</id>
<build>
<plugins>
<!-- process template and put it into target test dir -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.maven-exec-plugin}</version>
<executions>
<execution>
<id>process-oc-template</id>
<phase>process-test-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>oc</executable>
<commandlineArgs>process -f ${project.basedir}/${template.name} -o=yaml</commandlineArgs>
<outputFile>${project.build.testOutputDirectory}/${template.name}</outputFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.maven-failsafe-plugin}</version>
<executions>
<execution>
<id>run-integration-tests</id>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*ETest.java</include>
</includes>
<systemProperties>
<property>
<name>env.config.resource.name</name>
<value>${template.name}</value>
</property>
</systemProperties>
</configuration>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
@@ -0,0 +1,62 @@
/**
* Copyright 2017 The Jaeger Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package io.jaegertracing.openshift;

import java.io.IOException;
import java.net.URL;

import org.arquillian.cube.kubernetes.annotations.Named;
import org.arquillian.cube.kubernetes.annotations.PortForward;
import org.arquillian.cube.requirement.ArquillianConditionalRunner;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

import io.fabric8.kubernetes.api.model.v2_2.Service;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

/**
* @author Pavol Loffay
*/
@RunWith(ArquillianConditionalRunner.class)
public class AllInOneETest {
private static final String SERVICE_NAME = "jaeger-all-in-one";

private OkHttpClient okHttpClient = new OkHttpClient.Builder()
.build();

@Named(SERVICE_NAME)
@ArquillianResource
private Service jaegerService;

@Named(SERVICE_NAME)
@PortForward
@ArquillianResource
private URL jaegerUiUrl;

@Test
public void testUiResponds() throws IOException, InterruptedException {
Request request = new Request.Builder()
.url(jaegerUiUrl)
.get()
.build();

try (Response response = okHttpClient.newCall(request).execute()) {
Assert.assertEquals(200, response.code());
}
}
}
25 changes: 25 additions & 0 deletions all-in-one/src/test/resources/arquillian.xml
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!--
Copyright 2017 The Jaeger Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.
-->
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

<extension qualifier="openshift">
</extension>

</arquillian>
11 changes: 11 additions & 0 deletions header.txt
@@ -0,0 +1,11 @@
Copyright ${license.git.copyrightYears} The Jaeger Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.

0 comments on commit 173f90f

Please sign in to comment.