From 9ae67558a0d54b8a6413a6a26a7b0ca8c50c2c6c Mon Sep 17 00:00:00 2001 From: phala Date: Wed, 6 Mar 2024 16:44:05 +0100 Subject: [PATCH] make gateway fixture session scope --- testsuite/tests/conftest.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/testsuite/tests/conftest.py b/testsuite/tests/conftest.py index b8a4df3c..b1ddf063 100644 --- a/testsuite/tests/conftest.py +++ b/testsuite/tests/conftest.py @@ -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"] @@ -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"): @@ -268,11 +268,11 @@ 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( @@ -280,10 +280,11 @@ def gateway(request, kuadrant, openshift, blame, backend, module_label, testconf 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 @@ -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() @@ -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