Skip to content

Commit

Permalink
Merge pull request #80 from pehala/remove_operator
Browse files Browse the repository at this point in the history
Move authorino_parameters to upper conftest
  • Loading branch information
pehala authored Sep 7, 2022
2 parents c45c025 + 895f901 commit 45923f2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 54 deletions.
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.

0 comments on commit 45923f2

Please sign in to comment.