Skip to content

Commit

Permalink
make gateway fixture session scope
Browse files Browse the repository at this point in the history
  • Loading branch information
pehala committed Mar 6, 2024
1 parent 3eb83fe commit 9ae6755
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions testsuite/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def testconfig():
return settings


@pytest.fixture(scope="module")
@pytest.fixture(scope="session")
def openshift(testconfig):
"""OpenShift client for the primary namespace"""
client = testconfig["service_protection"]["project"]
Expand Down Expand Up @@ -249,7 +249,7 @@ def module_label(label):
return randomize(label)


@pytest.fixture(scope="module")
@pytest.fixture(scope="session")
def kuadrant(request):
"""Returns Kuadrant instance if exists, or None"""
if request.config.getoption("--standalone"):
Expand All @@ -268,22 +268,23 @@ def backend(request, openshift, blame, label):
return httpbin


@pytest.fixture(scope="module")
def gateway(request, kuadrant, openshift, blame, backend, module_label, testconfig, wildcard_domain) -> Gateway:
@pytest.fixture(scope="session")
def gateway(request, kuadrant, openshift, blame, label, testconfig, wildcard_domain) -> Gateway:
"""Deploys Envoy that wire up the Backend behind the reverse-proxy and Authorino instance"""
if kuadrant:
gw = KuadrantGateway.create_instance(openshift, blame("gw"), wildcard_domain, {"app": module_label})
gw = KuadrantGateway.create_instance(openshift, blame("gw"), wildcard_domain, {"app": label})
else:
authorino = request.getfixturevalue("authorino")
gw = Envoy(
openshift,
blame("gw"),
authorino,
testconfig["service_protection"]["envoy"]["image"],
labels={"app": module_label},
labels={"app": label},
)
request.addfinalizer(gw.delete)
gw.commit()
gw.wait_for_ready(timeout=20 * 60)
return gw


Expand All @@ -301,7 +302,7 @@ def route(request, kuadrant, gateway, blame, hostname, backend, module_label) ->
return route


@pytest.fixture(scope="module")
@pytest.fixture(scope="session")
def exposer(request) -> Exposer:
"""Exposer object instance"""
exposer = OpenShiftExposer()
Expand All @@ -317,7 +318,7 @@ def hostname(gateway, exposer, blame) -> Hostname:
return hostname


@pytest.fixture(scope="module")
@pytest.fixture(scope="session")
def wildcard_domain(openshift):
"""
Wildcard domain of openshift cluster
Expand Down

0 comments on commit 9ae6755

Please sign in to comment.