-
Notifications
You must be signed in to change notification settings - Fork 205
Added wazuh-kubernetes PR checks #1273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
teddytpc1
merged 24 commits into
main
from
change/954-development-kubernetes-adapt-the-pr-tests
Dec 26, 2025
Merged
Added wazuh-kubernetes PR checks #1273
teddytpc1
merged 24 commits into
main
from
change/954-development-kubernetes-adapt-the-pr-tests
Dec 26, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 tasks
…954-development-kubernetes-adapt-the-pr-tests
…954-development-kubernetes-adapt-the-pr-tests
teddytpc1
previously approved these changes
Dec 26, 2025
Member
Author
Local test execution:cbordon@cbordon-HP-255-15-6-inch-G10-Notebook-PC:~/Documents/wazuh/repositorios/wazuh-kubernetes$ pytest tests/k8s_pytest.py --deployment-type local -v
=========================================================================================================== test session starts ============================================================================================================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/cbordon/Documents/wazuh/repositorios/wazuh-kubernetes
collected 6 items
tests/k8s_pytest.py::TestWazuhKubernetes::test_indexer_cluster_health FAILED [ 16%]
tests/k8s_pytest.py::TestWazuhKubernetes::test_indexer_indices_health PASSED [ 33%]
tests/k8s_pytest.py::TestWazuhKubernetes::test_indexer_nodes_count PASSED [ 50%]
tests/k8s_pytest.py::TestWazuhKubernetes::test_wazuh_templates PASSED [ 66%]
tests/k8s_pytest.py::TestWazuhKubernetes::test_manager_services_running FAILED [ 83%]
tests/k8s_pytest.py::TestWazuhKubernetes::test_dashboard_service_url PASSED [100%]
================================================================================================================= FAILURES =================================================================================================================
_____________________________________________________________________________________________ TestWazuhKubernetes.test_indexer_cluster_health ______________________________________________________________________________________________
self = <k8s_pytest.TestWazuhKubernetes object at 0x708d52f81d00>, namespace = 'wazuh'
def test_indexer_cluster_health(self, namespace):
"""Check if Wazuh indexer cluster health is green"""
cmd = f'kubectl -n {namespace} exec -it wazuh-indexer-0 -- curl -XGET "https://localhost:9200/_cluster/health" -u {ADMIN_USER}:{ADMIN_PASSWORD} -k -s'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
print(f"Cluster health status: {result.stdout}")
> assert "green" in result.stdout, "Cluster health is not green"
E AssertionError: Cluster health is not green
E assert 'green' in '{"cluster_name":"wazuh-cluster","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"discovered_master":true,"discovered_cluster_manager":true,"active_primary_shards":119,"active_shards":119,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":39,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":75.31645569620254}'
E + where '{"cluster_name":"wazuh-cluster","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"discovered_master":true,"discovered_cluster_manager":true,"active_primary_shards":119,"active_shards":119,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":39,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":75.31645569620254}' = CompletedProcess(args='kubectl -n wazuh exec -it wazuh-indexer-0 -- curl -XGET "https://localhost:9200/_cluster/health" -u admin:admin -k -s', returncode=0, stdout='{"cluster_name":"wazuh-cluster","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"discovered_master":true,"discovered_cluster_manager":true,"active_primary_shards":119,"active_shards":119,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":39,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":75.31645569620254}', stderr='Defaulted container "wazuh-indexer" out of: wazuh-indexer, volume-mount-hack (init), increase-the-vm-max-map-count (init)\nUnable to use a TTY - input is not a terminal or the right kind of file\n').stdout
tests/k8s_pytest.py:29: AssertionError
----------------------------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------------------------
Cluster health status: {"cluster_name":"wazuh-cluster","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"discovered_master":true,"discovered_cluster_manager":true,"active_primary_shards":119,"active_shards":119,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":39,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":75.31645569620254}
____________________________________________________________________________________________ TestWazuhKubernetes.test_manager_services_running _____________________________________________________________________________________________
self = <k8s_pytest.TestWazuhKubernetes object at 0x708d52fc26f0>, namespace = 'wazuh'
def test_manager_services_running(self, namespace):
"""Check if Wazuh manager has at least 10 services running"""
cmd = f'kubectl -n {namespace} exec -it wazuh-manager-master-0 -- /var/ossec/bin/wazuh-control status'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
print("Wazuh Manager services status:")
print(result.stdout)
running_services = len(re.findall(r'is running', result.stdout))
print(f"Running services: {running_services}")
> assert running_services >= 10, f"Expected at least 10 running services, found {running_services}"
E AssertionError: Expected at least 10 running services, found 9
E assert 9 >= 10
tests/k8s_pytest.py:83: AssertionError
----------------------------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------------------------
Wazuh Manager services status:
wazuh-clusterd is running...
wazuh-modulesd is running...
wazuh-monitord is running...
wazuh-logcollector is running...
wazuh-remoted is running...
wazuh-syscheckd is running...
wazuh-analysisd not running...
wazuh-execd is running...
wazuh-db is running...
wazuh-authd is running...
wazuh-apid not running...
Running services: 9
========================================================================================================= short test summary info ==========================================================================================================
FAILED tests/k8s_pytest.py::TestWazuhKubernetes::test_indexer_cluster_health - AssertionError: Cluster health is not green
FAILED tests/k8s_pytest.py::TestWazuhKubernetes::test_manager_services_running - AssertionError: Expected at least 10 running services, found 9
======================================================================================================= 2 failed, 4 passed in 0.97s ======================================================================================================== |
Member
Author
Local test for EKS:cbordon@cbordon-HP-255-15-6-inch-G10-Notebook-PC:~/Documents/wazuh/repositorios/wazuh-kubernetes$ pytest tests/k8s_pytest.py --deployment-type eks --dashboard-url "a0f7c065aa8f84b2bb9a31501127b190-52b2fcfec4f935d5.elb.us-west-1.amazonaws.com" -v
=========================================================================================================== test session starts ============================================================================================================
platform linux -- Python 3.12.3, pytest-7.4.4, pluggy-1.4.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/cbordon/Documents/wazuh/repositorios/wazuh-kubernetes
collected 6 items
tests/k8s_pytest.py::TestWazuhKubernetes::test_indexer_cluster_health PASSED [ 16%]
tests/k8s_pytest.py::TestWazuhKubernetes::test_indexer_indices_health PASSED [ 33%]
tests/k8s_pytest.py::TestWazuhKubernetes::test_indexer_nodes_count PASSED [ 50%]
tests/k8s_pytest.py::TestWazuhKubernetes::test_wazuh_templates PASSED [ 66%]
tests/k8s_pytest.py::TestWazuhKubernetes::test_manager_services_running PASSED [ 83%]
tests/k8s_pytest.py::TestWazuhKubernetes::test_dashboard_service_url PASSED [100%]
============================================================================================================ 6 passed in 24.62s ============================================================================================================ |
teddytpc1
approved these changes
Dec 26, 2025
vcerenu
approved these changes
Dec 26, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
close #954
Description
Two PR checks are added, one to validate EKS and another to validate the local deployment with MiniKube.
Tests
https://github.com/wazuh/wazuh-kubernetes/actions/runs/20525640321/job/58968384522?pr=1273
Note
The test failure is expected because it is related to the problem indicated here: #1268 (comment)
EKS test: https://github.com/wazuh/wazuh-kubernetes/actions/runs/20525640306/job/58968384486?pr=1273
Note
The EKS test will be executed on demand