Skip to content

Commit e9ad720

Browse files
committed
add metrics test for the history server
1 parent 4996847 commit e9ad720

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
metadata:
5+
name: metrics
6+
commands:
7+
- script: kubectl exec -n $NAMESPACE python -- python /test-scripts/metrics.py
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestStep
4+
metadata:
5+
name: install-test-container
6+
timeout: 300
7+
---
8+
apiVersion: v1
9+
kind: ConfigMap
10+
metadata:
11+
name: test-scripts
12+
data:
13+
metrics.py: |
14+
import sys
15+
import logging
16+
import requests
17+
18+
if __name__ == "__main__":
19+
LOG_LEVEL = "DEBUG" # if args.debug else 'INFO'
20+
logging.basicConfig(
21+
level=LOG_LEVEL,
22+
format="%(asctime)s %(levelname)s: %(message)s",
23+
stream=sys.stdout,
24+
)
25+
26+
response = requests.get("http://spark-history-node-default-metrics:18081/metrics")
27+
28+
assert response.status_code == 200, (
29+
f"Expected HTTP return code 200 from the metrics endpoint but got [{response.status_code}]"
30+
)
31+
32+
assert "jmx_scrape_error" in response.text, (
33+
"Expected metric [jmx_scrape_error] not found"
34+
)
35+
---
36+
apiVersion: v1
37+
kind: Pod
38+
metadata:
39+
name: python
40+
spec:
41+
containers:
42+
- name: tools
43+
image: oci.stackable.tech/sdp/testing-tools:0.2.0-stackable0.0.0-dev
44+
stdin: true
45+
tty: true
46+
resources:
47+
requests:
48+
memory: "128Mi"
49+
cpu: "512m"
50+
limits:
51+
memory: "128Mi"
52+
cpu: "1"
53+
volumeMounts:
54+
- name: test-scripts
55+
mountPath: /test-scripts
56+
volumes:
57+
- name: test-scripts
58+
configMap:
59+
name: test-scripts

0 commit comments

Comments
 (0)