diff --git a/pkg/tnf/hack/test-transition-events.sh b/pkg/tnf/hack/test-transition-events.sh new file mode 100755 index 0000000000..9e670c94bf --- /dev/null +++ b/pkg/tnf/hack/test-transition-events.sh @@ -0,0 +1,66 @@ +#!/usr/bin/bash +# Test script to validate transition event format on a live cluster. +# Creates mock events identical to what our code produces, then verifies +# they appear correctly in `oc get events`. +# +# Usage: ./hack/test-transition-events.sh +# Requires: oc/kubectl with cluster-admin access + +set -euo pipefail + +NAMESPACE="openshift-etcd" +TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ") + +events=( + "EtcdTransitionAuthCompleted|PCS authentication completed on all nodes" + "EtcdTransitionClusterConfigured|Pacemaker cluster configured successfully" + "EtcdTransitionFencingConfigured|STONITH fencing configured successfully" + "EtcdTransitionEtcdResourceCreated|Pacemaker etcd resource agent (podman-etcd) configured" + "EtcdTransitionConstraintsConfigured|Pacemaker ordering and colocation constraints configured" + "EtcdTransitionStarted|Etcd transition from CEO-controlled to pacemaker-controlled has started" + "EtcdTransitionWaitingForRemoval|Waiting for CEO to remove static etcd container from all nodes" + "EtcdTransitionStaticContainerRemoved|Static etcd container removed from all nodes, revision is stable" + "EtcdTransitionCompleted|Etcd transition to pacemaker-controlled has completed" +) + +echo "Creating ${#events[@]} test transition events in ${NAMESPACE}..." + +for entry in "${events[@]}"; do + reason="${entry%%|*}" + message="${entry#*|}" + name="test-${reason,,}-$(date +%s%N)" + + oc apply -f - <