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

Move authorino_parameters to upper conftest #80

Merged
merged 1 commit into from
Sep 7, 2022
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
11 changes: 11 additions & 0 deletions testsuite/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Root conftest"""
from urllib.parse import urlparse

import pytest
from keycloak import KeycloakAuthenticationError

Expand Down Expand Up @@ -125,3 +127,12 @@ def envoy(request, authorino, openshift, blame, backend, module_label):
request.addfinalizer(envoy.delete)
envoy.commit()
return envoy


@pytest.fixture(scope="session")
def wildcard_domain(openshift):
"""
Wildcard domain of openshift cluster
"""
hostname = urlparse(openshift.api_url).hostname
return "*.apps." + hostname.split(".", 1)[1]
15 changes: 13 additions & 2 deletions testsuite/tests/kuadrant/authorino/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,29 @@


@pytest.fixture(scope="module")
def authorino(authorino, openshift, blame, request, testconfig, module_label) -> Authorino:
def authorino_parameters():
"""Optional parameters for Authorino creation, passed to the __init__"""
return {}


@pytest.fixture(scope="module")
def authorino(authorino, openshift, blame, request, testconfig, module_label, authorino_parameters) -> Authorino:
"""Authorino instance"""
if authorino:
return authorino

if not testconfig["authorino"]["deploy"]:
if len(authorino_parameters) > 0:
return pytest.skip("Can't change parameters of already deployed Authorino")
return PreexistingAuthorino(testconfig["authorino"]["url"])

labels = authorino_parameters.setdefault("label_selectors", [])
labels.append(f"testRun={module_label}")

authorino = AuthorinoCR.create_instance(openshift,
blame("authorino"),
image=weakget(testconfig)["authorino"]["image"] % None,
label_selectors=[f"testRun={module_label}"])
**authorino_parameters)
request.addfinalizer(lambda: authorino.delete(ignore_not_found=True))
authorino.commit()
authorino.wait_for_ready()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@


@pytest.fixture(scope="module")
def cluster_wide():
def authorino_parameters():
"""Deploy Authorino in ClusterWide mode"""
return True
return {"cluster_wide": True}


@pytest.fixture(scope="module")
Expand Down
50 changes: 0 additions & 50 deletions testsuite/tests/kuadrant/authorino/operator/conftest.py

This file was deleted.