Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENTESB-15044] Refactor monitoring test to be able consume camel quar… #1790

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions e2e/yaks/openshift/monitoring/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
86 changes: 44 additions & 42 deletions e2e/yaks/openshift/monitoring/app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,52 +15,54 @@
-->

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

<groupId>com.github.openshift-integration</groupId>
<artifactId>camel-k-example-metrics</artifactId>
<version>master-SNAPSHOT</version>
<groupId>com.github.openshift-integration</groupId>
<artifactId>camel-k-example-metrics</artifactId>
<version>1.0.0-SNAPSHOT</version>

<name>camel-k-example-metrics</name>
<name>camel-k-example-metrics</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Will be replaced by sed to test specific version. -->
<version.camel.quarkus>1.0.0-CR2</version.camel.quarkus>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-microprofile-metrics</artifactId>
<version>1.0.0-CR2</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-microprofile-metrics</artifactId>
<version>${version.camel.quarkus}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.jandex</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<version>1.0.7</version>
<executions>
<execution>
<id>make-index</id>
<goals>
<goal>jandex</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.jandex</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<version>1.0.7</version>
<executions>
<execution>
<id>make-index</id>
<goals>
<goal>jandex</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
26 changes: 26 additions & 0 deletions e2e/yaks/openshift/monitoring/dependencyInstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.

SOURCE_DIR=$( dirname "${BASH_SOURCE[0]}")
APP_FOLDER="${SOURCE_DIR}/app"

mvn clean install -f $APP_FOLDER
LOCAL_MVN_HOME=$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout)

OPERATOR_POD=$(oc -n ${YAKS_NAMESPACE} get pods -l name=camel-k-operator --no-headers -o custom-columns=NAME:.metadata.name)
oc -n ${YAKS_NAMESPACE} exec $OPERATOR_POD -- mkdir -p /tmp/artifacts/m2/com/github/openshift-integration/camel-k-example-metrics/1.0.0-SNAPSHOT/
oc -n ${YAKS_NAMESPACE} rsync $LOCAL_MVN_HOME/com/github/openshift-integration/camel-k-example-metrics/1.0.0-SNAPSHOT/ $OPERATOR_POD:/tmp/artifacts/m2/com/github/openshift-integration/camel-k-example-metrics/1.0.0-SNAPSHOT/ --exclude=\* --include=camel-k-example-metrics-1.0.0-SNAPSHOT.\* --no-perms=true
8 changes: 4 additions & 4 deletions e2e/yaks/openshift/monitoring/metrics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Feature: Camel K can serve metrics to Prometheus
Given URL: https://thanos-querier.openshift-monitoring:9091

Scenario: Integration gets the message from the timer
Given integration metrics is running
Then integration metrics should print Successfully processed
Given Camel-K integration metrics is running
Then Camel-K integration metrics should print Successfully processed
Then sleep 120000 ms

Scenario: Thanos is able to serve custom microprofile annotation metrics
Given HTTP request header Authorization is "Bearer TOKEN"
Given HTTP request header Authorization is "Bearer ${openshift.token}"
When send GET /api/v1/query?query=application_camel_k_example_metrics_attempt_total
Then verify HTTP response expressions
| $.status | success |
Expand All @@ -19,7 +19,7 @@ Feature: Camel K can serve metrics to Prometheus
And receive HTTP 200

Scenario: Thanos is able to serve custom camel microprofile metrics
Given HTTP request header Authorization is "Bearer TOKEN"
Given HTTP request header Authorization is "Bearer ${openshift.token}"
When send GET /api/v1/query?query=application_camel_k_example_metrics_error_total
Then verify HTTP response expressions
| $.status | success |
Expand Down
10 changes: 5 additions & 5 deletions e2e/yaks/openshift/monitoring/obtainToken.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

SOURCE_DIR=$( dirname "${BASH_SOURCE[0]}")
TEST_FILE="${SOURCE_DIR}/metrics.feature"

TOKEN=`kubectl config view --minify --output 'jsonpath={..token}'`
sed -i -e "s/TOKEN/${TOKEN}/g" "${TEST_FILE}"
TOKEN=`oc config view --minify --output 'jsonpath={..token}'`
echo "openshift.token=${TOKEN}" > openshift-token.properties
oc -n ${YAKS_NAMESPACE} create secret generic openshift-token-secret --from-file=openshift-token.properties
oc -n ${YAKS_NAMESPACE} label secret openshift-token-secret yaks.citrusframework.org/test=metrics
rm openshift-token.properties
8 changes: 6 additions & 2 deletions e2e/yaks/openshift/monitoring/yaks-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ config:
pre:
- name: ObtainToken
script: ./obtainToken.sh
- name: installation
- name: Camel-k install
run: |
kamel install -w -n ${YAKS_NAMESPACE}
kamel run --name metrics Metrics.java -w -n $YAKS_NAMESPACE --dependency github:apache:camel-k:master-SNAPSHOT
- name: Dependency install
script: ./dependencyInstall.sh
- name: Integration run
run: |
kamel run --name metrics Metrics.java -w -n $YAKS_NAMESPACE --dependency mvn:com.github.openshift-integration:camel-k-example-metrics:1.0.0-SNAPSHOT
21 changes: 0 additions & 21 deletions jitpack.yml

This file was deleted.