Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test updates (Enable race detection and disable output interceptor) #956

Merged
merged 4 commits into from
Oct 24, 2024
Merged
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 10 additions & 0 deletions make/integration-tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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)
13 changes: 12 additions & 1 deletion pkg/library/kuadrant/apimachinery_status_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()]
}

Expand Down
Loading