Skip to content
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

2825 fix multigroups #2829

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import hashlib
import os
import re
import subprocess as sb
from time import sleep

import pytest
Expand All @@ -51,6 +52,7 @@
remove_agent_group
from wazuh_testing.tools import REMOTE_DAEMON, WAZUH_PATH, configuration
from wazuh_testing.tools.file import delete_file
import wazuh_testing.tools as tools
from wazuh_testing.tools.services import check_daemon_status, control_service
from wazuh_testing.tools.wazuh_manager import remove_agents

Expand Down Expand Up @@ -103,8 +105,9 @@ def prepare_environment(request, register_agent):
new_agent_group()

agent_id = getattr(request.module, 'response_data')['id']
with open(os.path.join(groups_folder, agent_id), "w") as f:
f.write(f"default,{DEFAULT_TESTING_GROUP_NAME}")

sb.run([f"{tools.WAZUH_PATH}/bin/agent_groups", "-q", "-a", "-i", agent_id, "-g", 'default'])
sb.run([f"{tools.WAZUH_PATH}/bin/agent_groups", "-q", "-a", "-i", agent_id, "-g", DEFAULT_TESTING_GROUP_NAME])

yield

Expand Down Expand Up @@ -166,13 +169,13 @@ def test_merged_mg_file_content(metadata, configure_local_internal_options_modul
- prepare_environment:
type: fixture
brief: Configure a custom environment for testing.

assertions:
- Verify that the file exists or not in the multigroups directory.
- Verify that the file is or is not in the merged.mg file

input_description: Different test cases defined in a YAML file.

expected_output:
- r'^!0 testing_file$'
'''
Expand Down