Skip to content

Commit

Permalink
introduce kcp into testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Čáp committed Sep 20, 2022
1 parent 8c40dec commit 16a3095
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
2 changes: 2 additions & 0 deletions config/settings.local.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# kubeconfig_path: "~/.kube/config" # Optional: Kubeconfig to use, if None the default one is used
# openshift2:
# project: "kuadrant2" # Required: Secondary OpenShift project, for running tests across projects
# kcp: # Required for glbc tests: if no further configuration needed pass en empty dict
# project: "glbc-test" # Optional: namespace for glbc tests to run, if None uses current namespace
# tools:
# project: "tools" # Optional: OpenShift project, where external tools are located
# rhsso:
Expand Down
11 changes: 6 additions & 5 deletions testsuite/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, name, default, **kwargs) -> None:
**kwargs)


_openshift_validator = Validator("openshift", eq=None)
_kcp_validator = Validator("kcp.project", must_exist=True)

settings = Dynaconf(
environments=True,
Expand All @@ -30,10 +30,11 @@ def __init__(self, name, default, **kwargs) -> None:
envvar_prefix="KUADRANT",
merge_enabled=True,
validators=[
_openshift_validator | Validator("authorino.url", must_exist=True),
_openshift_validator | DefaultValueValidator("rhsso.url", must_exist=True, default=fetch_route("no-ssl-sso")),
_openshift_validator | DefaultValueValidator("rhsso.password", must_exist=True,
default=fetch_secret("credential-sso", "ADMIN_PASSWORD")),
_kcp_validator | Validator("authorino.deploy", eq=True) | Validator("authorino.url", must_exist=True),
_kcp_validator | DefaultValueValidator("rhsso.url", must_exist=True, default=fetch_route("no-ssl-sso")),
_kcp_validator | DefaultValueValidator("rhsso.password",
must_exist=True,
default=fetch_secret("credential-sso", "ADMIN_PASSWORD")),
],
loaders=["testsuite.config.openshift_loader", "dynaconf.loaders.env_loader"]
)
7 changes: 7 additions & 0 deletions testsuite/config/openshift_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ def load(obj, env=None, silent=True, key=None, filename=None):
if "openshift2" in obj and "project" in obj["openshift2"]:
openshift2 = client.change_project(obj["openshift2"]["project"])
obj["openshift2"] = openshift2

kcp = None
if "kcp" in obj and "project" in obj["kcp"]:
kcp_section = config["kcp"]
kcp = client.change_project(kcp_section["project"] % None)
kcp.is_ready = lambda _: True
obj["kcp"] = kcp
14 changes: 14 additions & 0 deletions testsuite/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ def openshift2(testconfig):
return client


@pytest.fixture(scope="session")
def kcp(testconfig):
"""Modified OpenShift client acting as Kcp client"""
client = testconfig["kcp"]
if client is None:
pytest.skip("Kcp required but was not configured")

# does not work for kcp yet
# if not client.connected:
# pytest.fail("You are not logged into Openshift or the namespace for Kcp doesn't exist")

return client


@pytest.fixture(scope="session")
def rhsso(request, testconfig, blame):
"""RHSSO OIDC Provider fixture"""
Expand Down

0 comments on commit 16a3095

Please sign in to comment.