-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3146 from wazuh/fix-wdb-getconfig
IT: Fix tests fails caused by stats socket changes
- Loading branch information
Showing
8 changed files
with
124 additions
and
89 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
125 changes: 73 additions & 52 deletions
125
tests/integration/test_logtest/test_log_process_options/data/rules_verbose.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,95 @@ | ||
--- | ||
- | ||
name: 'rules_debug_omitted' | ||
rule_file: 'rules_verbose.xml' | ||
name: rules_debug_omitted | ||
rule_file: rules_verbose.xml | ||
rule_id: '880002' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\", \"test_child\" : \"ok\"}","log_format": "syslog","location": "master->/var/log/syslog"}}' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\", \"test_child\" : \"ok\"}", | ||
"log_format": "syslog","location": "master->/var/log/syslog"}}' | ||
- | ||
name: 'rules_debug_true' | ||
rule_file: 'rules_verbose.xml' | ||
name: rules_debug_true | ||
rule_file: rules_verbose.xml | ||
rule_id: '880001' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog","location": "master->/var/log/syslog","options":{"rules_debug":true}}}' | ||
verbose_mode: True | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog", | ||
"location": "master->/var/log/syslog","options":{"rules_debug":true}}}' | ||
verbose_mode: true | ||
- | ||
name: 'rules_debug_false' | ||
rule_file: 'rules_verbose.xml' | ||
name: rules_debug_false | ||
rule_file: rules_verbose.xml | ||
rule_id: '880001' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog","location": "master->/var/log/syslog","options":{"rules_debug":false}}}' | ||
verbose_mode: False | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog", | ||
"location": "master->/var/log/syslog","options":{"rules_debug":false}}}' | ||
verbose_mode: false | ||
- | ||
name: 'rules_debug_bad_type_string' | ||
rule_file: 'rules_verbose.xml' | ||
name: rules_debug_bad_type_string | ||
rule_file: rules_verbose.xml | ||
rule_id: '880001' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog","location": "master->/var/log/syslog","options":{"rules_debug":"true"}}}' | ||
verbose_mode: False | ||
warning_message: "WARNING: \\(\\d+\\): 'rules_debug' field must be a boolean. The parameter will be ignored" | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog", | ||
"location": "master->/var/log/syslog","options":{"rules_debug":"true"}}}' | ||
verbose_mode: false | ||
warning_message: ".*WARNING: .*: ('rules_debug' field must be a boolean. The parameter will be ignored).*" | ||
- | ||
name: 'rules_debug_bad_type_number' | ||
rule_file: 'rules_verbose.xml' | ||
name: rules_debug_bad_type_number | ||
rule_file: rules_verbose.xml | ||
rule_id: '880001' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog","location": "master->/var/log/syslog","options":{"rules_debug":123}}}' | ||
verbose_mode: False | ||
warning_message: "WARNING: \\(\\d+\\): 'rules_debug' field must be a boolean. The parameter will be ignored" | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog", | ||
"location": "master->/var/log/syslog","options":{"rules_debug":123}}}' | ||
verbose_mode: false | ||
warning_message: ".*WARNING: .*: ('rules_debug' field must be a boolean. The parameter will be ignored).*" | ||
- | ||
name: 'rules_debug_bad_type_object' | ||
rule_file: 'rules_verbose.xml' | ||
name: rules_debug_bad_type_object | ||
rule_file: rules_verbose.xml | ||
rule_id: '880001' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog","location": "master->/var/log/syslog","options":{"rules_debug":{"test":"true"}}}}' | ||
verbose_mode: False | ||
warning_message: "WARNING: \\(\\d+\\): 'rules_debug' field must be a boolean. The parameter will be ignored" | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog", | ||
"location": "master->/var/log/syslog","options":{"rules_debug":{"test":"true"}}}}' | ||
verbose_mode: false | ||
warning_message: ".*WARNING: .*: ('rules_debug' field must be a boolean. The parameter will be ignored).*" | ||
- | ||
name: 'rules_debug_bad_type_array' | ||
rule_file: 'rules_verbose.xml' | ||
name: rules_debug_bad_type_array | ||
rule_file: rules_verbose.xml | ||
rule_id: '880001' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog","location": "master->/var/log/syslog","options":{"rules_debug":["true", "false"]}}}' | ||
verbose_mode: False | ||
warning_message: "WARNING: \\(\\d+\\): 'rules_debug' field must be a boolean. The parameter will be ignored" | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog", | ||
"location": "master->/var/log/syslog","options":{"rules_debug":["true", "false"]}}}' | ||
verbose_mode: false | ||
warning_message: ".*WARNING: .*: ('rules_debug' field must be a boolean. The parameter will be ignored).*" | ||
- | ||
name: 'options_bad_type_boolean' | ||
rule_file: 'rules_verbose.xml' | ||
name: options_bad_type_boolean | ||
rule_file: rules_verbose.xml | ||
rule_id: '880001' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog","location": "master->/var/log/syslog","options":true}}' | ||
verbose_mode: False | ||
warning_message: "WARNING: \\(\\d+\\): 'options' field must be a JSON object. The parameter will be ignored" | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog", | ||
"location": "master->/var/log/syslog","options":true}}' | ||
verbose_mode: false | ||
warning_message: "WARNING: .*: ('options' field must be a JSON object. The parameter will be ignored)" | ||
- | ||
name: 'options_bad_type_array' | ||
rule_file: 'rules_verbose.xml' | ||
name: options_bad_type_array | ||
rule_file: rules_verbose.xml | ||
rule_id: '880001' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog","location": "master->/var/log/syslog","options":["true", "false"]}}' | ||
verbose_mode: False | ||
warning_message: "WARNING: \\(\\d+\\): 'options' field must be a JSON object. The parameter will be ignored" | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog", | ||
"location": "master->/var/log/syslog","options":["true", "false"]}}' | ||
verbose_mode: false | ||
warning_message: "WARNING: .*: ('options' field must be a JSON object. The parameter will be ignored)" | ||
- | ||
name: 'options_bad_type_number' | ||
rule_file: 'rules_verbose.xml' | ||
name: options_bad_type_number | ||
rule_file: rules_verbose.xml | ||
rule_id: '880001' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog","location": "master->/var/log/syslog","options":123456}}' | ||
verbose_mode: False | ||
warning_message: "WARNING: \\(\\d+\\): 'options' field must be a JSON object. The parameter will be ignored" | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog", | ||
"location": "master->/var/log/syslog","options":123456}}' | ||
verbose_mode: false | ||
warning_message: "WARNING: .*: ('options' field must be a JSON object. The parameter will be ignored)" | ||
- | ||
name: 'options_bad_type_string' | ||
rule_file: 'rules_verbose.xml' | ||
name: options_bad_type_string | ||
rule_file: rules_verbose.xml | ||
rule_id: '880001' | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog","location": "master->/var/log/syslog","options":"true"}}' | ||
verbose_mode: False | ||
warning_message: "WARNING: \\(\\d+\\): 'options' field must be a JSON object. The parameter will be ignored" | ||
input: '{"version":1,"origin":{"name":"Integration Test","module":"api"},"command":"log_processing","parameters":{ | ||
"event": "{\"it_logtest\" : \"rules_verbose\", \"test\": \"last_match\"}","log_format": "syslog", | ||
"location": "master->/var/log/syslog","options":"true"}}' | ||
verbose_mode: false | ||
warning_message: "WARNING: .*: ('options' field must be a JSON object. The parameter will be ignored)" |
This file contains 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
This file contains 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
52 changes: 31 additions & 21 deletions
52
tests/integration/test_wazuh_db/data/global/wazuhdb_getconfig.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,41 @@ | ||
--- | ||
- | ||
name: 'Get config missing parameter' | ||
name: Get config missing parameter | ||
test_case: | ||
- | ||
input: 'wazuhdb getconfig' | ||
output: "err Invalid DB query syntax, near 'getconfig'" | ||
- | ||
input: '{"version": 1, "origin": {"module": "api"}, "command": "getconfig", "module": "api"}' | ||
output: '{"error":4,"message":"Empty parameters","data":{}}' | ||
|
||
- | ||
name: 'Get config empty parameter' | ||
name: Get config empty parameters | ||
test_case: | ||
- | ||
input: 'wazuhdb getconfig ' | ||
output: 'err Failed reading wazuh-db config' | ||
- | ||
input: '{"version": 1, "origin": {"module": "api"}, "command": "getconfig", "module": "api", "parameters": {}}' | ||
output: '{"error":5,"message":"Empty section","data":{}}' | ||
- | ||
name: 'Get config wrong parameter' | ||
name: Get config empty section | ||
test_case: | ||
- | ||
input: 'wazuhdb getconfig wrong_parameter' | ||
output: 'err Failed reading wazuh-db config' | ||
- | ||
input: '{"version": 1, "origin": {"module": "api"}, "command": "getconfig", "module": "api", "parameters": { | ||
"section":}}' | ||
output: '{"error":1,"message":"Invalid JSON input","data":{}}' | ||
- | ||
name: 'Get internal config' | ||
name: Get config wrong parameter | ||
test_case: | ||
- | ||
input: 'wazuhdb getconfig internal' | ||
output: "{'wazuh_db': {'commit_time_max': 60, 'commit_time_min': 10, 'open_db_limit': 64, 'worker_pool_size': 8}}" | ||
- | ||
input: '{"version": 1, "origin": {"module": "api"}, "command": "getconfig", "module": "api", "parameters": { | ||
"section": "wrong_parameter"}}' | ||
output: '{"error":6,"message":"Unrecognized or not configured section","data":{}}' | ||
- | ||
name: 'Get wdb config' | ||
name: Get internal config | ||
test_case: | ||
- | ||
input: 'wazuhdb getconfig wdb' | ||
output: "{'wdb': {'backup': [{'database': 'global', 'enabled': True, 'interval': 86400, 'max_files': 3}]}}" | ||
- | ||
input: '{"version": 1, "origin": {"module": "api"}, "command": "getconfig", "module": "api", "parameters": { | ||
"section": "internal"}}' | ||
output: '"data":{"wazuh_db":{"commit_time_max":60,"commit_time_min":10,"open_db_limit":64,"worker_pool_size":8}}' | ||
- | ||
name: Get wdb config | ||
test_case: | ||
- | ||
input: '{"version": 1, "origin": {"module": "api"}, "command": "getconfig", "module": "api", "parameters": { | ||
"section": "wdb"}}' | ||
output: '"data":{"wdb":{"backup":[{"database":"global","enabled":true,"interval":86400,"max_files":3}]}' |
This file contains 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