Skip to content

Commit b064649

Browse files
committed
fix metrics test and move to commons folder
1 parent 97973b8 commit b064649

4 files changed

Lines changed: 21 additions & 86 deletions

File tree

tests/templates/kuttl/smoke/check-metrics.py renamed to tests/templates/kuttl/commons/check-metrics.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,18 @@ def try_get(url):
1313
retries = 3
1414
for i in range(retries):
1515
try:
16-
r = requests.get(url, timeout=5, auth=("trino", ""))
16+
if "coordinator" in url:
17+
r = requests.get(
18+
url,
19+
timeout=5,
20+
headers={"x-trino-user": "admin"},
21+
auth=("admin", "admin"),
22+
verify=False,
23+
)
24+
else:
25+
r = requests.get(
26+
url, timeout=5, headers={"x-trino-user": "admin"}, verify=False
27+
)
1728
r.raise_for_status()
1829
return r
1930
except requests.exceptions.HTTPError as errh:
@@ -31,17 +42,15 @@ def try_get(url):
3142
def check_monitoring(hosts):
3243
for host in hosts:
3344
# test for the jmx exporter metrics
34-
url = host + ":8081"
45+
url = "http://" + host + ":8081/metrics"
3546
response = try_get(url)
3647

37-
if response.ok:
38-
continue
39-
else:
48+
if not response.ok:
4049
print("Error for [" + url + "]: could not access monitoring")
4150
exit(-1)
4251

4352
# test for the native metrics
44-
url = host + ":8443/metrics"
53+
url = "https://" + host + ":8443/metrics"
4554
response = try_get(url)
4655

4756
if response.ok:
@@ -51,7 +60,6 @@ def check_monitoring(hosts):
5160
else:
5261
print("Error for [" + url + "]: missing metrics")
5362
exit(-1)
54-
continue
5563
else:
5664
print("Error for [" + url + "]: could not access monitoring")
5765
exit(-1)
@@ -65,8 +73,10 @@ def check_monitoring(hosts):
6573
args = vars(all_args.parse_args())
6674
namespace = args["namespace"]
6775

68-
host_coordinator_0 = f"http://trino-coordinator-default-0.trino-coordinator-default.{namespace}.svc.cluster.local"
69-
host_worker_0 = f"http://trino-worker-default-0.trino-worker-default.{namespace}.svc.cluster.local"
76+
host_coordinator_0 = f"trino-coordinator-default-0.trino-coordinator-default.{namespace}.svc.cluster.local"
77+
host_worker_0 = (
78+
f"trino-worker-default-0.trino-worker-default.{namespace}.svc.cluster.local"
79+
)
7080

7181
hosts = [host_coordinator_0, host_worker_0]
7282

tests/templates/kuttl/smoke/21-copy-scripts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ commands:
55
- script: kubectl cp -n $NAMESPACE ./check-active-workers.py trino-test-helper-0:/tmp || true
66
- script: kubectl cp -n $NAMESPACE ./check-opa.py trino-test-helper-0:/tmp || true
77
- script: kubectl cp -n $NAMESPACE ./check-s3.py trino-test-helper-0:/tmp || true
8-
- script: kubectl cp -n $NAMESPACE ./check-metrics.py trino-test-helper-0:/tmp || true
8+
- script: kubectl cp -n $NAMESPACE ../../../../templates/kuttl/commons/check-metrics.py trino-test-helper-0:/tmp || true

tests/templates/kuttl/smoke_aws/21-copy-scripts.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ commands:
55
- script: kubectl cp -n $NAMESPACE ./check-active-workers.py trino-test-helper-0:/tmp || true
66
- script: kubectl cp -n $NAMESPACE ./check-opa.py trino-test-helper-0:/tmp || true
77
- script: kubectl cp -n $NAMESPACE ./check-s3.py trino-test-helper-0:/tmp || true
8-
- script: kubectl cp -n $NAMESPACE ./check-metrics.py trino-test-helper-0:/tmp || true
8+
- script: kubectl cp -n $NAMESPACE ../../../../templates/kuttl/commons/check-metrics.py trino-test-helper-0:/tmp || true

tests/templates/kuttl/smoke_aws/check-metrics.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)