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

Use modul label for AuthConfig when sharding is tested #530

Merged
merged 1 commit into from
Sep 10, 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
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Conftest for authorino sharding tests"""

import pytest
from weakget import weakget

from testsuite.kuadrant.authorino import AuthorinoCR
from testsuite.kuadrant.policy.authorization import Value, JsonResponse
from testsuite.gateway.envoy import Envoy
from testsuite.kuadrant.policy.authorization.auth_config import AuthConfig
Expand Down Expand Up @@ -46,7 +48,26 @@ def _route(hostname, gateway):


@pytest.fixture(scope="module")
def setup_authorization(request, blame, cluster, module_label): # pylint: disable=unused-argument
def setup_authorino(cluster, blame, testconfig, module_label, request):
"""Authorino instance"""

def _authorino(sharding_label):
authorino = AuthorinoCR.create_instance(
cluster,
blame("authorino"),
image=weakget(testconfig)["authorino"]["image"] % None,
label_selectors=[f"sharding={sharding_label}", f"testRun={module_label}"],
)
request.addfinalizer(authorino.delete)
authorino.commit()
authorino.wait_for_ready()
return authorino

return _authorino


@pytest.fixture(scope="module")
def setup_authorization(request, blame, cluster, module_label):
"""Factory method for creating AuthConfigs in the test run"""

def _authorization(route, sharding_label=None):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,10 @@
"""Test for preexisting authorino bug issue:https://github.com/Kuadrant/testsuite/issues/69"""

import pytest
from weakget import weakget

from testsuite.kuadrant.authorino import AuthorinoCR

pytestmark = [pytest.mark.authorino, pytest.mark.standalone_only]


@pytest.fixture(scope="module")
def setup_authorino(cluster, blame, testconfig, module_label, request):
"""Authorino instance"""

def _authorino(sharding_label):
authorino = AuthorinoCR.create_instance(
cluster,
blame("authorino"),
image=weakget(testconfig)["authorino"]["image"] % None,
label_selectors=[f"sharding={sharding_label}", f"testRun={module_label}"],
)
request.addfinalizer(authorino.delete)
authorino.commit()
authorino.wait_for_ready()
return authorino

return _authorino


@pytest.mark.issue("https://github.com/Kuadrant/authorino/pull/349")
def test_preexisting_auth(
setup_authorino, setup_authorization, setup_gateway, setup_route, exposer, wildcard_domain, blame
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@


@pytest.fixture(scope="module")
def authorino_parameters(authorino_parameters):
"""Setup sharding for authorino"""
authorino_parameters["label_selectors"] = ["sharding=A"]
yield authorino_parameters
def authorino(setup_authorino):
"""Creates authorino with sharding label"""
return setup_authorino(sharding_label="A")


def test_sharding(setup_authorization, setup_gateway, setup_route, authorino, exposer, blame):
Expand Down
Loading