Skip to content

Commit

Permalink
Merge pull request #633 from emmaaroche/gateway-policy-attach-fix
Browse files Browse the repository at this point in the history
Fix AuthPolicy attachment to Gateway instead of HTTPRoute
  • Loading branch information
azgabur authored Feb 19, 2025
2 parents 8713552 + f31f689 commit 7d040d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
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

0 comments on commit 7d040d4

Please sign in to comment.