Skip to content

Commit 45923f2

Browse files
authored
Merge pull request #80 from pehala/remove_operator
Move authorino_parameters to upper conftest
2 parents c45c025 + 895f901 commit 45923f2

File tree

4 files changed

+26
-54
lines changed

4 files changed

+26
-54
lines changed

testsuite/tests/conftest.py

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""Root conftest"""
2+
from urllib.parse import urlparse
3+
24
import pytest
35
from keycloak import KeycloakAuthenticationError
46

@@ -125,3 +127,12 @@ def envoy(request, authorino, openshift, blame, backend, module_label):
125127
request.addfinalizer(envoy.delete)
126128
envoy.commit()
127129
return envoy
130+
131+
132+
@pytest.fixture(scope="session")
133+
def wildcard_domain(openshift):
134+
"""
135+
Wildcard domain of openshift cluster
136+
"""
137+
hostname = urlparse(openshift.api_url).hostname
138+
return "*.apps." + hostname.split(".", 1)[1]

testsuite/tests/kuadrant/authorino/conftest.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,29 @@
1111

1212

1313
@pytest.fixture(scope="module")
14-
def authorino(authorino, openshift, blame, request, testconfig, module_label) -> Authorino:
14+
def authorino_parameters():
15+
"""Optional parameters for Authorino creation, passed to the __init__"""
16+
return {}
17+
18+
19+
@pytest.fixture(scope="module")
20+
def authorino(authorino, openshift, blame, request, testconfig, module_label, authorino_parameters) -> Authorino:
1521
"""Authorino instance"""
1622
if authorino:
1723
return authorino
1824

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

30+
labels = authorino_parameters.setdefault("label_selectors", [])
31+
labels.append(f"testRun={module_label}")
32+
2233
authorino = AuthorinoCR.create_instance(openshift,
2334
blame("authorino"),
2435
image=weakget(testconfig)["authorino"]["image"] % None,
25-
label_selectors=[f"testRun={module_label}"])
36+
**authorino_parameters)
2637
request.addfinalizer(lambda: authorino.delete(ignore_not_found=True))
2738
authorino.commit()
2839
authorino.wait_for_ready()

testsuite/tests/kuadrant/authorino/operator/clusterwide/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66

77
@pytest.fixture(scope="module")
8-
def cluster_wide():
8+
def authorino_parameters():
99
"""Deploy Authorino in ClusterWide mode"""
10-
return True
10+
return {"cluster_wide": True}
1111

1212

1313
@pytest.fixture(scope="module")

testsuite/tests/kuadrant/authorino/operator/conftest.py

-50
This file was deleted.

0 commit comments

Comments
 (0)