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 Oct 4, 2022
1 parent efc0965 commit 992d563
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 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
# 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
9 changes: 9 additions & 0 deletions testsuite/config/openshift_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ 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)
# when advanced scheduling is enabled on kcp/syncer, status field is not synced back from workload cluster
# deployment, is_ready method depends on status field that is not available yet hence we have to mock it
kcp.is_ready = lambda _: True
obj["kcp"] = kcp
16 changes: 16 additions & 0 deletions testsuite/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ 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
# internally implemented using `oc status` command that seems internally touching project kind
# that is not available on kcp
# 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 992d563

Please sign in to comment.