Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ tests:
IP_STACK=v4
NETWORK_TYPE="OVNKubernetes"
MIRROR_IMAGES=false
observers:
enable:
- observers-resource-watch
test:
- ref: kubernetes-nmstate-e2e-operator
- ref: kubernetes-nmstate-e2e-monitor-tests
workflow: kubernetes-nmstate-e2e-operator
- always_run: false
as: e2e-handler-azure
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
approvers:
- cybertron
- phoracek
- qinqon
- rhrazdil
reviewers:
- cybertron
- phoracek
- qinqon
- ramlavi
- rhrazdil
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -euo pipefail

export KUBECONFIG=${SHARED_DIR}/kubeconfig

MONITOR_DIR="${ARTIFACT_DIR}/monitor-tests"
mkdir -p "${MONITOR_DIR}"

DISABLE_ARGS=""
if [[ -n "${DISABLED_MONITOR_TESTS:-}" ]]; then
DISABLE_ARGS="--disable-monitor=${DISABLED_MONITOR_TESTS}"
fi

echo "Starting openshift-tests run-monitor..."
openshift-tests run-monitor ${DISABLE_ARGS} --artifact-dir "${MONITOR_DIR}" &
MONITOR_PID=$!

echo "Monitoring cluster for ${MONITOR_DURATION} seconds..."
sleep "${MONITOR_DURATION}"

echo "Stopping monitor and evaluating results..."
kill -TERM "${MONITOR_PID}" 2>/dev/null || true

set +e
wait "${MONITOR_PID}"
monitor_exit=$?
set -e

echo "Monitor exited with code: ${monitor_exit}"

# Copy junit results to artifact dir for CI reporting
find "${MONITOR_DIR}" -name "junit*.xml" -exec cp {} "${ARTIFACT_DIR}/" \; 2>/dev/null || true

# Exit code 143 (128+15) means SIGTERM was not caught by the process.
# A well-behaved openshift-tests handles SIGTERM, evaluates results, and exits
# with 0 (pass) or non-zero (failures detected).
if [ "${monitor_exit}" -ne 0 ] && [ "${monitor_exit}" -ne 143 ]; then
echo "ERROR: Monitor tests detected failures (exit code: ${monitor_exit})"
exit 1
fi

echo "Monitor tests completed successfully."
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"path": "kubernetes-nmstate/e2e/monitor-tests/kubernetes-nmstate-e2e-monitor-tests-ref.yaml",
"owners": {
"approvers": [
"cybertron",
"phoracek",
"qinqon",
"rhrazdil"
],
"reviewers": [
"cybertron",
"phoracek",
"qinqon",
"ramlavi",
"rhrazdil"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ref:
as: kubernetes-nmstate-e2e-monitor-tests
from: tests
commands: kubernetes-nmstate-e2e-monitor-tests-commands.sh
env:
- name: MONITOR_DURATION
default: "60"
documentation: |-
Duration in seconds to run the monitor tests before evaluating results.
- name: DISABLED_MONITOR_TESTS
default: ""
documentation: |-
Comma-separated list of monitor tests to disable. Example:
"apiserver-new-disruption-invariant,disruption-summary-serializer"
resources:
requests:
cpu: 100m
memory: 200Mi
timeout: 30m0s
documentation: |-
Runs openshift-tests run-monitor for a configurable duration and fails the
job if any monitor tests detect issues such as pods using the default service
account, API server disruptions, or other cluster state violations.