@@ -892,13 +892,7 @@ func runtimeHookTestHandler(ctx context.Context, c client.Client, cluster *clust
892892
893893 // Check if the hook keeps blocking.
894894 Consistently (func (_ Gomega ) bool {
895- if ! topologyConditionCheck () {
896- return false
897- }
898- if ! blockingCondition () {
899- return false
900- }
901- return true
895+ return topologyConditionCheck () && blockingCondition ()
902896 }, 60 * time .Second ).Should (BeTrue (),
903897 fmt .Sprintf ("Cluster Topology reconciliation continued unexpectedly: hook %s not blocking" , hookName ))
904898
@@ -924,19 +918,19 @@ func runtimeHookTestHandler(ctx context.Context, c client.Client, cluster *clust
924918 Byf ("Waiting for %s hook to stop blocking" , hookName )
925919
926920 Eventually (func (_ Gomega ) bool {
927- if topologyConditionCheck () {
928- return false
921+ if hook == "BeforeClusterDelete" {
922+ // Only check blockingCondition for BeforeClusterDelete, because topologyConditionCheck
923+ // always returns true for the BeforeClusterDelete hook.
924+ return blockingCondition ()
929925 }
930- if blockingCondition () {
931- return false
932- }
933- return true
926+ return topologyConditionCheck () || blockingCondition ()
934927 }, intervals ... ).Should (BeFalse (),
935928 fmt .Sprintf ("ClusterTopology reconcile did not proceed as expected when calling %s" , hookName ))
936929}
937930
938931func computeHookName (hook string , attributes []string ) string {
939- return strings .Join (append ([]string {hook }, attributes ... ), "-" )
932+ // Note: + is not a valid character for ConfigMap keys (only alphanumeric characters, '-', '_' or '.')
933+ return strings .ReplaceAll (strings .Join (append ([]string {hook }, attributes ... ), "-" ), "+" , "_" )
940934}
941935
942936// clusterConditionShowsHookBlocking checks if the TopologyReconciled condition message contains both the hook name and hookFailedMessage.
0 commit comments