Skip to content

test: kubectl-dns secret-generation command#841

Open
averevki wants to merge 1 commit intoKuadrant:mainfrom
averevki:dns-cli
Open

test: kubectl-dns secret-generation command#841
averevki wants to merge 1 commit intoKuadrant:mainfrom
averevki:dns-cli

Conversation

@averevki
Copy link
Contributor

Description

  • Add support for kubectl-dns CLI tool integration to the test suite
  • Implement wrapper class and test for the kubectl-dns secret-generation command
  • Refactor CLI tooling by moving kuadrantctl into a dedicated testsuite/cli/ module

Verification steps

Run the new test:

poetry run pytest -vv testsuite/tests/multicluster/coredns/two_clusters/kubectl-dns/test_secret_generation.py

Note: This test requires:

  • The kubectl-dns binary to be available in PATH or configured in config/settings.local.yaml
  • A multicluster CoreDNS setup with one primary and one secondary cluster
  • 2 kubeconfigs containing certificate-authority key with the cluster CA. You can set it for a kubeconfig by logging in with explicitly specified path to the cluster CA, aka. oc login --username=${} --password=${} <clusterapiurl> --certificate-authority=path/to/ca

@averevki averevki requested review from azgabur and trepel January 12, 2026 17:08
@averevki averevki self-assigned this Jan 12, 2026
@averevki averevki added Test case New test case DNS Issues for DNSOperator labels Jan 12, 2026
@averevki averevki moved this to Ready For Review in Kuadrant Jan 12, 2026
Signed-off-by: averevki <sandyverevkin@gmail.com>
@averevki
Copy link
Contributor Author

/make smoke

@github-actions
Copy link

github-actions bot commented Jan 26, 2026

Test run completed (make smoke) and can be found here

Short Test Summary
=========================== short test summary info ============================
FAILED testsuite/tests/singlecluster/authorino/identity/auth/test_auth_identity.py::test_auth_identity[keycloak] - assert 200 == 401
 +  where 200 = <testsuite.httpx.Result object at 0x7f5627ccb170>.status_code
========================= 1 failed, 4 passed in 47.19s =========================
Full Output
poetry lock
Creating virtualenv kuadrant-testsuite-6EPd9kcO-py3.12 in /home/runner/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies...

Writing lock file
Installing dependencies from lock file

Package operations: 64 installs, 0 updates, 0 removals

  - Installing aiofiles (25.1.0)
  - Installing anyio (4.12.1)
  - Installing apyproxy (0.2.2)
  - Installing authzed (1.24.1)
  - Installing backoff (2.2.1)
  - Installing build (1.4.0)
  - Installing cel-python (0.2.0)
  - Installing certifi (2026.1.4)
  - Installing cffi (2.0.0)
  - Installing charset-normalizer (3.4.4)
  - Installing cryptography (46.0.3)
  - Installing deprecation (2.1.0)
  - Installing dnspython (2.8.0)
  - Installing dynaconf (3.2.12)
  - Installing execnet (2.1.2)
  - Installing google-re2 (1.1.20251105)
  - Installing googleapis-common-protos (1.72.0)
  - Installing greenlet (3.3.1)
  - Installing grpc-interceptor (0.15.4)
  - Installing grpcio (1.76.0)
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/api/annotations_pb2.py over existing file
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/api/annotations_pb2.pyi over existing file
  - Installing h11 (0.16.0)
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/api/http_pb2.py over existing file
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/api/http_pb2.pyi over existing file
  - Installing h2 (4.3.0)
  - Installing hpack (4.1.0)
  - Installing httpcore (1.0.9)
  - Installing httpx (0.28.1)
  - Installing hyperframe (6.1.0)
  - Installing idna (3.11)
  - Installing iniconfig (2.3.0)
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/rpc/status_pb2.py over existing file
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/rpc/status_pb2.pyi over existing file
  - Installing jinja2 (3.1.6)
  - Installing jmespath (1.1.0)
  - Installing jwcrypto (1.5.6)
  - Installing lark (0.12.0)
  - Installing lxml (6.0.2)
  - Installing markupsafe (3.0.3)
  - Installing openshift-client (2.0.5)
  - Installing packaging (26.0)
  - Installing playwright (1.57.0)
  - Installing pluggy (1.6.0)
  - Installing protobuf (6.33.4)
  - Installing protovalidate (1.0.0)
  - Installing pycparser (3.0)
  - Installing pyee (13.0.0)
  - Installing pygments (2.19.2)
  - Installing pyjwt (2.10.1)
  - Installing pyproject-hooks (1.2.0)
  - Installing pytest (9.0.2)
  - Installing pytest-base-url (2.1.0)
  - Installing pytest-html (4.2.0)
  - Installing pytest-metadata (3.1.1)
  - Installing pytest-playwright (0.7.2)
  - Installing pytest-xdist (3.8.0)
  - Installing python-dateutil (2.9.0.post0)
  - Installing python-keycloak (7.0.2)
  - Installing python-slugify (8.0.4)
  - Installing pyyaml (6.0.3)
  - Installing requests (2.32.5)
  - Installing requests-toolbelt (1.0.0)
  - Installing six (1.17.0)
  - Installing text-unidecode (1.3)
  - Installing types-python-dateutil (2.9.0.20260124)
  - Installing types-pyyaml (6.0.12.20250915)
  - Installing typing-extensions (4.15.0)
  - Installing urllib3 (2.6.3)
  - Installing weakget (1.0)
poetry run python -m pytest --tb=short -o cache_dir=./.pytest_cache.smoke -n4 -m 'smoke' --dist loadfile --enforce -vv testsuite/tests/
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.2, pluggy-1.6.0 -- /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/bin/python
cachedir: .pytest_cache.smoke
metadata: {'Python': '3.12.3', 'Platform': 'Linux-6.11.0-1018-azure-x86_64-with-glibc2.39', 'Packages': {'pytest': '9.0.2', 'pluggy': '1.6.0'}, 'Plugins': {'base-url': '2.1.0', 'playwright': '0.7.2', 'xdist': '3.8.0', 'html': '4.2.0', 'anyio': '4.12.1', 'metadata': '3.1.1'}, 'CI': 'true', 'JAVA_HOME': '/usr/lib/jvm/temurin-17-jdk-amd64', 'Base URL': '', 'Kuadrant': []}

rootdir: /home/runner/work/testsuite/testsuite
configfile: pyproject.toml
plugins: base-url-2.1.0, playwright-0.7.2, xdist-3.8.0, html-4.2.0, anyio-4.12.1, metadata-3.1.1
created: 4/4 workers
4 workers [5 items]

scheduling tests via LoadFileScheduling

testsuite/tests/singlecluster/limitador/test_basic_limit.py::test_limit[2 requests every 15 sec-route] 
testsuite/tests/singlecluster/gateway/test_basic.py::test_gateway_readiness 
testsuite/tests/singlecluster/authorino/identity/auth/test_auth_identity.py::test_auth_identity[keycloak] 
[gw3] [ 20%] FAILED testsuite/tests/singlecluster/authorino/identity/auth/test_auth_identity.py::test_auth_identity[keycloak] 
[gw0] [ 40%] PASSED testsuite/tests/singlecluster/gateway/test_basic.py::test_gateway_readiness 
testsuite/tests/singlecluster/gateway/test_basic.py::test_gateway_basic_dns_tls 
[gw1] [ 60%] PASSED testsuite/tests/singlecluster/limitador/test_basic_limit.py::test_limit[2 requests every 15 sec-route] 
testsuite/tests/singlecluster/limitador/test_basic_limit.py::test_limit[2 requests every 15 sec-gateway] 
[gw1] [ 80%] PASSED testsuite/tests/singlecluster/limitador/test_basic_limit.py::test_limit[2 requests every 15 sec-gateway] 
[gw0] [100%] PASSED testsuite/tests/singlecluster/gateway/test_basic.py::test_gateway_basic_dns_tls 

=================================== FAILURES ===================================
_________________________ test_auth_identity[keycloak] _________________________
[gw3] linux -- Python 3.12.3 /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/bin/python
testsuite/tests/singlecluster/authorino/identity/auth/test_auth_identity.py:41: in test_auth_identity
    assert response.status_code == 401
E   assert 200 == 401
E    +  where 200 = <testsuite.httpx.Result object at 0x7f5627ccb170>.status_code
------------------------------ Captured log call -------------------------------
15:40:48 +0000 INFO:httpx:HTTP Request: GET http://172.18.255.207/get "HTTP/1.1 200 OK"
=========================== short test summary info ============================
FAILED testsuite/tests/singlecluster/authorino/identity/auth/test_auth_identity.py::test_auth_identity[keycloak] - assert 200 == 401
 +  where 200 = <testsuite.httpx.Result object at 0x7f5627ccb170>.status_code
========================= 1 failed, 4 passed in 47.19s =========================
make: *** [Makefile:33: smoke] Error 1

@averevki
Copy link
Contributor Author

/make smoke

@github-actions
Copy link

github-actions bot commented Jan 26, 2026

Test run completed (make smoke) and can be found here

Short Test Summary

Full Output
poetry lock
Creating virtualenv kuadrant-testsuite-6EPd9kcO-py3.12 in /home/runner/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies...

Writing lock file
Installing dependencies from lock file

Package operations: 64 installs, 0 updates, 0 removals

  - Installing aiofiles (25.1.0)
  - Installing anyio (4.12.1)
  - Installing apyproxy (0.2.2)
  - Installing authzed (1.24.1)
  - Installing backoff (2.2.1)
  - Installing build (1.4.0)
  - Installing cel-python (0.2.0)
  - Installing certifi (2026.1.4)
  - Installing cffi (2.0.0)
  - Installing charset-normalizer (3.4.4)
  - Installing cryptography (46.0.3)
  - Installing deprecation (2.1.0)
  - Installing dnspython (2.8.0)
  - Installing dynaconf (3.2.12)
  - Installing execnet (2.1.2)
  - Installing google-re2 (1.1.20251105)
  - Installing googleapis-common-protos (1.72.0)
  - Installing greenlet (3.3.1)
  - Installing grpc-interceptor (0.15.4)
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/api/annotations_pb2.py over existing file
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/api/annotations_pb2.pyi over existing file
  - Installing grpcio (1.76.0)
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/api/http_pb2.py over existing file
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/api/http_pb2.pyi over existing file
  - Installing h11 (0.16.0)
  - Installing h2 (4.3.0)
  - Installing hpack (4.1.0)
  - Installing httpcore (1.0.9)
  - Installing httpx (0.28.1)
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/rpc/status_pb2.py over existing file
Installing /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/lib/python3.12/site-packages/google/rpc/status_pb2.pyi over existing file
  - Installing hyperframe (6.1.0)
  - Installing idna (3.11)
  - Installing iniconfig (2.3.0)
  - Installing jinja2 (3.1.6)
  - Installing jmespath (1.1.0)
  - Installing jwcrypto (1.5.6)
  - Installing lark (0.12.0)
  - Installing lxml (6.0.2)
  - Installing markupsafe (3.0.3)
  - Installing openshift-client (2.0.5)
  - Installing packaging (26.0)
  - Installing playwright (1.57.0)
  - Installing pluggy (1.6.0)
  - Installing protobuf (6.33.4)
  - Installing protovalidate (1.0.0)
  - Installing pycparser (3.0)
  - Installing pyee (13.0.0)
  - Installing pygments (2.19.2)
  - Installing pyjwt (2.10.1)
  - Installing pyproject-hooks (1.2.0)
  - Installing pytest (9.0.2)
  - Installing pytest-base-url (2.1.0)
  - Installing pytest-html (4.2.0)
  - Installing pytest-metadata (3.1.1)
  - Installing pytest-playwright (0.7.2)
  - Installing pytest-xdist (3.8.0)
  - Installing python-dateutil (2.9.0.post0)
  - Installing python-keycloak (7.0.2)
  - Installing python-slugify (8.0.4)
  - Installing pyyaml (6.0.3)
  - Installing requests (2.32.5)
  - Installing requests-toolbelt (1.0.0)
  - Installing six (1.17.0)
  - Installing text-unidecode (1.3)
  - Installing types-python-dateutil (2.9.0.20260124)
  - Installing types-pyyaml (6.0.12.20250915)
  - Installing typing-extensions (4.15.0)
  - Installing urllib3 (2.6.3)
  - Installing weakget (1.0)
poetry run python -m pytest --tb=short -o cache_dir=./.pytest_cache.smoke -n4 -m 'smoke' --dist loadfile --enforce -vv testsuite/tests/
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.2, pluggy-1.6.0 -- /home/runner/.cache/pypoetry/virtualenvs/kuadrant-testsuite-6EPd9kcO-py3.12/bin/python
cachedir: .pytest_cache.smoke
metadata: {'Python': '3.12.3', 'Platform': 'Linux-6.11.0-1018-azure-x86_64-with-glibc2.39', 'Packages': {'pytest': '9.0.2', 'pluggy': '1.6.0'}, 'Plugins': {'base-url': '2.1.0', 'playwright': '0.7.2', 'xdist': '3.8.0', 'html': '4.2.0', 'anyio': '4.12.1', 'metadata': '3.1.1'}, 'CI': 'true', 'JAVA_HOME': '/usr/lib/jvm/temurin-17-jdk-amd64', 'Base URL': '', 'Kuadrant': []}

rootdir: /home/runner/work/testsuite/testsuite
configfile: pyproject.toml
plugins: base-url-2.1.0, playwright-0.7.2, xdist-3.8.0, html-4.2.0, anyio-4.12.1, metadata-3.1.1
created: 4/4 workers
4 workers [5 items]

scheduling tests via LoadFileScheduling

testsuite/tests/singlecluster/authorino/identity/auth/test_auth_identity.py::test_auth_identity[keycloak] 
testsuite/tests/singlecluster/limitador/test_basic_limit.py::test_limit[2 requests every 15 sec-route] 
testsuite/tests/singlecluster/gateway/test_basic.py::test_gateway_readiness 
[gw2] [ 20%] PASSED testsuite/tests/singlecluster/authorino/identity/auth/test_auth_identity.py::test_auth_identity[keycloak] 
[gw1] [ 40%] PASSED testsuite/tests/singlecluster/limitador/test_basic_limit.py::test_limit[2 requests every 15 sec-route] 
testsuite/tests/singlecluster/limitador/test_basic_limit.py::test_limit[2 requests every 15 sec-gateway] 
[gw0] [ 60%] PASSED testsuite/tests/singlecluster/gateway/test_basic.py::test_gateway_readiness 
testsuite/tests/singlecluster/gateway/test_basic.py::test_gateway_basic_dns_tls 
[gw1] [ 80%] PASSED testsuite/tests/singlecluster/limitador/test_basic_limit.py::test_limit[2 requests every 15 sec-gateway] 
[gw0] [100%] PASSED testsuite/tests/singlecluster/gateway/test_basic.py::test_gateway_basic_dns_tls 

============================== 5 passed in 42.72s ==============================

Copy link
Member

@azgabur azgabur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not run the test yet

obj.context = self.context
return obj

def create_merged_kubeconfig(self, cluster2: "KubernetesClient") -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to coredns tests we will probably deal with more then two clusters, maybe refactor this method to take list of additional clusters? wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should have other tests running this command. I would leave it for when a new test is being developed

def kubeconfig_secrets(request, testconfig, cluster, cluster2, kubectl_dns, blame):
"""Run generate-secret command on merged kubeconfig to generate kubeconfig secret for the secondary cluster"""
system_project = testconfig["service_protection"]["system_project"]
secret_name = blame("kubecfg")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would use tempfile library for a temporary file. Also there is missing finalizer for removing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binary creates this secret directly on cluster. I have finalizer set right under this comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DNS Issues for DNSOperator Test case New test case

Projects

Status: Ready For Review

Development

Successfully merging this pull request may close these issues.

2 participants