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

Fix AuthPolicy attachment to Gateway instead of HTTPRoute #633

Merged
merged 1 commit into from
Feb 19, 2025
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
8 changes: 5 additions & 3 deletions testsuite/tests/singlecluster/gateway/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from testsuite.gateway.gateway_api.gateway import KuadrantGateway
from testsuite.gateway.gateway_api.hostname import DNSPolicyExposer
from testsuite.httpx.auth import HttpxOidcClientAuth
from testsuite.kuadrant.policy.authorization.auth_policy import AuthPolicy
from testsuite.kuadrant.policy.dns import DNSPolicy
from testsuite.kuadrant.policy.tls import TLSPolicy

Expand All @@ -27,11 +28,12 @@ def gateway(request, cluster, blame, wildcard_domain, module_label):


@pytest.fixture(scope="module")
def authorization(authorization, oidc_provider):
def authorization(blame, gateway, module_label, cluster, oidc_provider, route):
# pylint: disable=unused-argument
"""Create AuthPolicy attached to gateway"""
authorization.identity.add_oidc("default", oidc_provider.well_known["issuer"])
return authorization
policy = AuthPolicy.create_instance(cluster, blame("authz"), gateway, labels={"app": module_label})
policy.identity.add_oidc("default", oidc_provider.well_known["issuer"])
return policy


@pytest.fixture(scope="module")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,9 @@

import pytest

from testsuite.kuadrant.policy.authorization.auth_policy import AuthPolicy

pytestmark = [pytest.mark.kuadrant_only, pytest.mark.dnspolicy]


@pytest.fixture(scope="module")
def authorization(oidc_provider, gateway, cluster, blame, module_label, route): # pylint: disable=unused-argument
"""Overwrite the authorization fixture and attach it to the gateway"""
policy = AuthPolicy.create_instance(cluster, blame("authz"), gateway, labels={"testRun": module_label})
policy.identity.add_oidc("default", oidc_provider.well_known["issuer"])
return policy


def test_update_auth_policy_target_ref(
gateway2, authorization, client, client2, auth, dns_policy, dns_policy2, change_target_ref
): # pylint: disable=unused-argument
Expand Down