diff --git a/Makefile b/Makefile index b1e6df5fa..0e0cea50f 100644 --- a/Makefile +++ b/Makefile @@ -345,7 +345,7 @@ run: export OPERATOR_NAMESPACE := $(OPERATOR_NAMESPACE) run: GIT_SHA=$(shell git rev-parse HEAD || echo "unknown") run: DIRTY=$(shell $(PROJECT_PATH)/utils/check-git-dirty.sh || echo "unknown") run: generate fmt vet ## Run a controller from your host. - go run -ldflags "-X main.gitSHA=${GIT_SHA} -X main.dirty=${DIRTY}" ./main.go + go run -ldflags "-X main.gitSHA=${GIT_SHA} -X main.dirty=${DIRTY}" --race ./main.go docker-build: GIT_SHA=$(shell git rev-parse HEAD || echo "unknown") docker-build: DIRTY=$(shell $(PROJECT_PATH)/utils/check-git-dirty.sh || echo "unknown") diff --git a/make/integration-tests.mk b/make/integration-tests.mk index a217ed7db..87b9e283c 100644 --- a/make/integration-tests.mk +++ b/make/integration-tests.mk @@ -22,6 +22,8 @@ test-bare-k8s-integration: clean-cov generate fmt vet ginkgo ## Requires only ba --fail-on-pending \ --keep-going \ --trace \ + --race \ + --output-interceptor-mode=none \ $(INTEGRATION_TESTS_EXTRA_ARGS) ./tests/bare_k8s/... .PHONY: test-gatewayapi-env-integration @@ -40,6 +42,8 @@ test-gatewayapi-env-integration: clean-cov generate fmt vet ginkgo ## Requires k --fail-on-pending \ --keep-going \ --trace \ + --race \ + --output-interceptor-mode=none \ $(INTEGRATION_TESTS_EXTRA_ARGS) ./tests/gatewayapi/... .PHONY: test-istio-env-integration @@ -58,6 +62,8 @@ test-istio-env-integration: clean-cov generate fmt vet ginkgo ## Requires kubern --fail-on-pending \ --keep-going \ --trace \ + --race \ + --output-interceptor-mode=none \ $(INTEGRATION_TESTS_EXTRA_ARGS) tests/istio/... test-envoygateway-env-integration: clean-cov generate fmt vet ginkgo ## Requires kubernetes cluster with GatewayAPI and EnvoyGateway installed. @@ -75,6 +81,8 @@ test-envoygateway-env-integration: clean-cov generate fmt vet ginkgo ## Requires --fail-on-pending \ --keep-going \ --trace \ + --race \ + --output-interceptor-mode=none \ $(INTEGRATION_TESTS_EXTRA_ARGS) tests/envoygateway/... .PHONY: test-integration @@ -93,4 +101,6 @@ test-integration: clean-cov generate fmt vet ginkgo ## Requires kubernetes clust --fail-on-pending \ --keep-going \ --trace \ + --race \ + --output-interceptor-mode=none \ $(INTEGRATION_TESTS_EXTRA_ARGS) $(INTEGRATION_TEST_PACKAGES) diff --git a/pkg/library/kuadrant/apimachinery_status_conditions.go b/pkg/library/kuadrant/apimachinery_status_conditions.go index 6c98f4bf8..4f605b14f 100644 --- a/pkg/library/kuadrant/apimachinery_status_conditions.go +++ b/pkg/library/kuadrant/apimachinery_status_conditions.go @@ -55,17 +55,28 @@ func (o *AffectedPolicyMap) RemoveAffectedPolicy(p Policy) { // IsPolicyAffected checks if the provided Policy is affected based on the tracking map maintained. func (o *AffectedPolicyMap) IsPolicyAffected(p Policy) bool { + o.mu.Lock() + defer o.mu.Unlock() + return o.policies[p.GetUID()] != nil } // IsPolicyOverridden checks if the provided Policy is affected based on the tracking map maintained. // It is overridden if there is policies affecting it func (o *AffectedPolicyMap) IsPolicyOverridden(p Policy) bool { - return o.IsPolicyAffected(p) && len(o.policies[p.GetUID()]) > 0 + pAffected := o.IsPolicyAffected(p) + + o.mu.Lock() + defer o.mu.Unlock() + + return pAffected && len(o.policies[p.GetUID()]) > 0 } // PolicyAffectedBy returns the clients keys that a policy is Affected by func (o *AffectedPolicyMap) PolicyAffectedBy(p Policy) []client.ObjectKey { + o.mu.Lock() + defer o.mu.Unlock() + return o.policies[p.GetUID()] }