Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d2c5eb7
Enable monitor testing in CI
IvanKavaldzhiev Dec 18, 2025
e7cc8a8
Add missing test configuration in values.yaml
IvanKavaldzhiev Dec 18, 2025
0c98e00
Remove unneeded properties and run helm test without filters
IvanKavaldzhiev Dec 19, 2025
d199872
Merge remote-tracking branch 'origin/main' into 11990-test-monitor-in-ci
IvanKavaldzhiev Dec 19, 2025
39c62f9
Merge remote-tracking branch 'origin/main' into 11990-test-monitor-in-ci
IvanKavaldzhiev Dec 22, 2025
f9bdee2
Resolve PR comments
IvanKavaldzhiev Dec 22, 2025
90d9b9a
Merge remote-tracking branch 'origin/main' into 11990-test-monitor-in-ci
IvanKavaldzhiev Dec 29, 2025
80709a7
Resolve PR comments
IvanKavaldzhiev Dec 29, 2025
7865229
Fix and enrich unit tests
IvanKavaldzhiev Dec 29, 2025
89b60cc
Merge remote-tracking branch 'origin/main' into 11990-test-monitor-in-ci
IvanKavaldzhiev Dec 30, 2025
37f6a59
Disable rest, restjava and web3 tests and fix variable naming
IvanKavaldzhiev Dec 30, 2025
6b826e7
Add sleep in monitor test pod, so that logs can be fetched
IvanKavaldzhiev Dec 30, 2025
559ba81
Revert sleep
IvanKavaldzhiev Jan 2, 2026
7c1f053
Merge remote-tracking branch 'origin/main' into 11990-test-monitor-in-ci
IvanKavaldzhiev Jan 5, 2026
59980e7
Add hook-failed annotation for monitor pod
IvanKavaldzhiev Jan 5, 2026
ba90516
Merge remote-tracking branch 'origin/main' into 11990-test-monitor-in-ci
IvanKavaldzhiev Jan 6, 2026
8413456
Override hook-delete-policty in correct place
IvanKavaldzhiev Jan 6, 2026
84bb955
Merge remote-tracking branch 'origin/main' into 11990-test-monitor-in-ci
IvanKavaldzhiev Jan 7, 2026
ed35867
Revert test disabling for rest, rest-java and web3
IvanKavaldzhiev Jan 7, 2026
e54429f
Update hook delete policy for rest-test
IvanKavaldzhiev Jan 7, 2026
7ef2445
Update hook-delete-policy for restjava-test
IvanKavaldzhiev Jan 7, 2026
f9fa043
Update hook-delete-policy for web3-test
IvanKavaldzhiev Jan 7, 2026
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
8 changes: 7 additions & 1 deletion .github/workflows/acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ jobs:
env:
HIERO_MIRROR_IMPORTER_BLOCK_NODES_0_HOST: 'block-node-1.${SOLO_NAMESPACE}.svc.cluster.local'
SPRING_PROFILES_ACTIVE: 'blocknode'
monitor:
test:
enabled: true
test:
cucumberTags: "@acceptance and not @ethereum and not @ethcall and not @crud"
annotations:
Expand All @@ -189,6 +192,9 @@ jobs:

else
cat <<EOF > mirror.yaml
monitor:
test:
enabled: true
test:
annotations:
helm.sh/hook-delete-policy: before-hook-creation
Expand Down Expand Up @@ -216,7 +222,7 @@ jobs:
- name: Run acceptance tests
run: |
helm test "${HELM_RELEASE_NAME}" -n "${SOLO_NAMESPACE}" --logs \
--filter name="${HELM_RELEASE_NAME}-mirror-acceptance" --timeout 20m | tee output_log.txt
--timeout 20m | tee output_log.txt

- name: Run k6 tests
if: ${{ matrix.stream-type != 'BLOCK' }}
Expand Down
107 changes: 107 additions & 0 deletions charts/hedera-mirror-monitor/postman.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"info": {
"_postman_id": "e015390f-8007-4371-8703-0b9ad853f718",
"name": "Monitor API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "25186531"
},
"item": [
{
"name": "Check Prometheus Publish/Subscribe Metrics Increasing",
"event": [
{
"listen": "test",
"script": {
"exec": [
"const baseUrl = pm.environment.get(\"baseUrl\");",
"const url = baseUrl + \"/actuator/prometheus\";",
"const numCalls = 4;",
"const intervalMs = 3000;",
"",
"function getMetricValue(body, metricName) {",
" const regex = new RegExp(`^${metricName}(?:\\\\{[^\\\\}]*\\\\})?\\\\s+([\\\\d.E+-]+)`, \"m\");",
" const matches = body.match(regex);",
" return matches ? parseFloat(matches[1]) : null;",
"}",
"",
"function collectMetrics(body) {",
" return {",
" subscribe: getMetricValue(body, \"hiero_mirror_monitor_subscribe_duration_seconds\"),",
" publish: getMetricValue(body, \"hiero_mirror_monitor_publish_duration_seconds\")",
" };",
"}",
"",
"let samples = [];",
"samples.push(collectMetrics(pm.response.text()));",
"",
"let callCount = 1;",
"",
"function nextCall() {",
" if (callCount < numCalls) {",
" setTimeout(() => {",
" pm.sendRequest(url, (err, res) => {",
" if (err) {",
" console.error(err);",
" } else {",
" samples.push(collectMetrics(res.text()));",
" }",
" callCount++;",
" nextCall();",
" });",
" }, intervalMs);",
" } else {",
" validateMetrics();",
" }",
"}",
"",
"function validateMetrics() {",
" pm.test(\"Should have collected \" + numCalls + \" samples\", () => {",
" pm.expect(samples.length).to.equal(numCalls);",
" });",
"",
" const metrics = [\"subscribe\", \"publish\"];",
" ",
" metrics.forEach(metric => {",
" pm.test(`${metric} duration should be increasing`, () => {",
" for (let i = 1; i < samples.length; i++) {",
" const prev = samples[i-1][metric];",
" const curr = samples[i][metric];",
" pm.expect(curr, `Sample ${i+1} (${curr}) should be greater than sample ${i} (${prev}) for ${metric}`).to.be.above(prev);",
" }",
" });",
" });",
"}",
"",
"if (pm.response.code === 200) {",
" nextCall();",
"} else {",
" pm.test(\"Initial request failed\", () => {",
" pm.expect.fail(`Status code ${pm.response.code}`);",
" });",
"}"
],
"type": "text/javascript",
"packages": {},
"requests": {}
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/actuator/prometheus",
"host": ["{{baseUrl}}"],
"path": ["actuator", "prometheus"]
}
},
"response": []
}
],
"variable": [
{
"key": "baseUrl",
"value": "http://localhost:8082"
}
]
}
15 changes: 15 additions & 0 deletions charts/hedera-mirror-monitor/templates/tests/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: Apache-2.0

{{ if .Values.test.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
annotations: {{- toYaml .Values.test.annotations | nindent 4 }}
labels: {{- include "hedera-mirror-monitor.labels" . | nindent 4 }}
app.kubernetes.io/name: {{ include "hedera-mirror-monitor.name" . }}-test
name: {{ include "hedera-mirror-monitor.fullname" . }}-test
namespace: {{ include "hedera-mirror-monitor.namespace" . }}
data:
postman.json: |-
{{- .Values.test.postman | b64dec | default (.Files.Get "postman.json") | nindent 4 }}
{{- end -}}
47 changes: 47 additions & 0 deletions charts/hedera-mirror-monitor/templates/tests/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# SPDX-License-Identifier: Apache-2.0

{{ if .Values.test.enabled -}}
apiVersion: v1
kind: Pod
metadata:
annotations: {{- toYaml .Values.test.annotations | nindent 4 }}
labels: {{- include "hedera-mirror-monitor.labels" . | nindent 4 }}
app.kubernetes.io/name: {{ include "hedera-mirror-monitor.name" . }}-test
name: {{ include "hedera-mirror-monitor.fullname" . }}-test
namespace: {{ include "hedera-mirror-monitor.namespace" . }}
spec:
containers:
- name: test
image: "{{ .Values.test.image.repository }}:{{ .Values.test.image.tag }}"
imagePullPolicy: {{ .Values.test.image.pullPolicy }}
args:
- run
- /test/postman.json
- --env-var
- baseUrl=http://{{ include "hedera-mirror-monitor.fullname" . }}:{{ .Values.service.port }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
readOnlyRootFilesystem: true
volumeMounts:
- name: monitor-test
mountPath: /test
readOnly: true
imagePullSecrets: {{ toYaml .Values.test.image.pullSecrets | nindent 4 }}
priorityClassName: {{ .Values.test.priorityClassName }}
restartPolicy: Never
securityContext:
fsGroup: 1000
runAsGroup: 1000
runAsNonRoot: true
runAsUser: 1000
seccompProfile:
type: RuntimeDefault
terminationGracePeriodSeconds: 1
volumes:
- name: monitor-test
configMap:
defaultMode: 420
name: {{ include "hedera-mirror-monitor.fullname" . }}-test
{{- end -}}
13 changes: 13 additions & 0 deletions charts/hedera-mirror-monitor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,19 @@ serviceMonitor:

terminationGracePeriodSeconds: 60

test:
annotations:
helm.sh/hook: test-success
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
enabled: true
image:
pullPolicy: IfNotPresent
pullSecrets: []
repository: postman/newman
tag: 6.1.3-alpine
postman: "" # Custom postman.json in base64 encoding
priorityClassName: ""

tolerations: []

updateStrategy:
Expand Down
Loading