@@ -892,13 +892,7 @@ func runtimeHookTestHandler(ctx context.Context, c client.Client, cluster *clust
892
892
893
893
// Check if the hook keeps blocking.
894
894
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 ()
902
896
}, 60 * time .Second ).Should (BeTrue (),
903
897
fmt .Sprintf ("Cluster Topology reconciliation continued unexpectedly: hook %s not blocking" , hookName ))
904
898
@@ -924,19 +918,19 @@ func runtimeHookTestHandler(ctx context.Context, c client.Client, cluster *clust
924
918
Byf ("Waiting for %s hook to stop blocking" , hookName )
925
919
926
920
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 ()
929
925
}
930
- if blockingCondition () {
931
- return false
932
- }
933
- return true
926
+ return topologyConditionCheck () || blockingCondition ()
934
927
}, intervals ... ).Should (BeFalse (),
935
928
fmt .Sprintf ("ClusterTopology reconcile did not proceed as expected when calling %s" , hookName ))
936
929
}
937
930
938
931
func 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 ... ), "-" ), "+" , "_" )
940
934
}
941
935
942
936
// clusterConditionShowsHookBlocking checks if the TopologyReconciled condition message contains both the hook name and hookFailedMessage.
0 commit comments