Compare commits

...

No commits in common. "c8" and "c10s" have entirely different histories.
c8 ... c10s

11 changed files with 93 additions and 2 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/parent-0.12.0.tar.gz
/parent-0.12.0.tar.gz

View File

@ -1 +0,0 @@
61ed0c2188d91bec8dc17b515087193bf9f42044 SOURCES/parent-0.12.0.tar.gz

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-8
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (parent-0.12.0.tar.gz) = e6674a59a87428d04700bc855eb87bd74d757e51e6a8c9d324647793c8489f26c0924d007ff0ba1de5e781cfb062b2401ff158a4affc3f9ad2e6780742cff0e7

62
tests/smoke_test.sh Executable file
View File

@ -0,0 +1,62 @@
#!/bin/bash
set -e
JAVA=$1
JAVA_VER=$2
AGENT_VERSION="0.12.0"
dir=$(mktemp -d)
pushd $dir
cat > prometheus_config.yaml <<EOF
---
lowercaseOutputName: true
lowercaseOutputLabelNames: true
blacklistObjectNames:
# handled by agent's default exporter
- "java.lang:*"
EOF
cat > HelloWait.java <<EOF
public class HelloWait {
public static void main(String[] args) {
System.out.println("Hello World");
try {
while (true) {
Thread.sleep(200);
}
} catch (InterruptedException e) {
// ignore
}
}
}
EOF
javac HelloWait.java
$JAVA/bin/java -javaagent:/usr/share/java/prometheus-jmx-exporter/jmx_prometheus_javaagent.jar=8080:prometheus_config.yaml -cp . HelloWait > hello_wait.out 2>&1 &
num_tries=0
while [ $num_tries -lt 10 ] && ! grep -q 'Hello World' hello_wait.out; do
sleep 1
num_tries=$(($num_tries + 1))
done
echo
if [ $num_tries -eq 10 ]; then
echo "Time out reached waiting for HelloWait to come up"
exit 1
fi
curl -s http://127.0.0.1:8080/metrics 2>&1 | tee prometheus.out
echo
echo
# jmx_exporter_build_info{version="0.12.0",name="jmx_prometheus_javaagent",} 1.0
grep "jmx_exporter_build_info" prometheus.out | grep -q "version=\"$AGENT_VERSION\""
# jvm_info{version="1.8.0_222-b10",vendor="Oracle Corporation",runtime="OpenJDK Runtime Environment",} 1.0
version="1.8.0"
if [ $JAVA_VER -ne 8 ]; then
version="11.0"
fi
grep "jvm_info" prometheus.out | grep -q "version=\"$version"
popd
rm -rf $dir
# Cleanup HelloWait process
kill $(jps | grep HelloWait | awk '{ print $1 }')
echo "JDK $JAVA_VER: Tests PASSED!"

16
tests/tests.yml Normal file
View File

@ -0,0 +1,16 @@
---
- hosts: localhost
roles:
- role: standard-test-basic
tags:
- classic
required_packages:
- prometheus-jmx-exporter-openjdk11
- curl
- java-1.8.0-openjdk-devel
- java-11-openjdk-devel
tests:
- agent_smoke_test:
dir: .
run: "./verify.sh"

7
tests/verify.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
#
# Verify Prometheus JVM agent on JDK 8 and JDK 11
set -e
./smoke_test.sh /usr/lib/jvm/java-1.8.0-openjdk 8
./smoke_test.sh /usr/lib/jvm/java-11-openjdk 11