Skip to content

Commit

Permalink
Merge branch 'master' into 2327-qa-docs-migrate-test-scan_results
Browse files Browse the repository at this point in the history
  • Loading branch information
snaow authored Jan 7, 2022
2 parents 49196d6 + 452cd21 commit 0afa402
Show file tree
Hide file tree
Showing 62 changed files with 4,642 additions and 1,157 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@ deps/wazuh_testing/wazuh_testing.egg-info/
# SearchUI package-lock
deps/wazuh_testing/wazuh_testing/qa_docs/Search-UI/package-lock.json


# GCP tests configuration file
tests/integration/test_gcloud/data/configuration.yaml
2 changes: 1 addition & 1 deletion deps/wazuh_testing/wazuh_testing/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def compare_config_api_response(configuration, section):

def get_manager_configuration(section=None, field=None):
"""Get Wazuh manager configuration response from API using GET /manager/configuration
References: https://documentation.wazuh.com/current/user-manual/api/reference.html#operation/api.controllers.manager_controller.get_configuration
Args:
Expand Down
14 changes: 7 additions & 7 deletions deps/wazuh_testing/wazuh_testing/gcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ def validate_gcp_event(event):


def callback_detect_start_gcp(line):
if 'wm_gcp_main(): INFO: Module started.' in line:
if 'wm_gcp_pubsub_main(): INFO: Module started.' in line:
return line
return None


def callback_detect_start_fetching_logs(line):
if 'wm_gcp_main(): DEBUG: Starting fetching of logs.' in line:
if 'wm_gcp_pubsub_main(): DEBUG: Starting fetching of logs.' in line:
return line
return None


def callback_detect_start_gcp_sleep(line):
match = re.match(r'.*wm_gcp_main\(\): DEBUG: Sleeping until: (\S+ \S+)', line)
match = re.match(r'.*wm_gcp_pubsub_main\(\): DEBUG: Sleeping until: (\S+ \S+)', line)

if match:
return match.group(1)
Expand All @@ -56,7 +56,7 @@ def detect_gcp_start(file_monitor):


def callback_received_messages_number(line):
match = re.match(r'.*wm_gcp_run\(\): INFO: - INFO - Received and acknowledged (\d+) messages', line)
match = re.match(r'.*wm_gcp_pubsub_run\(\): INFO: - INFO - Received and acknowledged (\d+) messages', line)
if match:
return match.group(1)
return None
Expand Down Expand Up @@ -95,8 +95,8 @@ def callback_detect_schedule_validate_parameters_err(line):


def callback_detect_gcp_read_err(line):
match_err = re.match(r'.*wm_gcp_read\(\): ERROR:.*', line)
match_warn = re.match(r'.*wm_gcp_read\(\): WARNING: File \'\S+\' not found.*', line)
match_err = re.match(r'.*wm_gcp_pubsub_read\(\): ERROR:.*', line)
match_warn = re.match(r'.*wm_gcp_pubsub_read\(\): WARNING: File \'\S+\' not found.*', line)

if match_err:
return line
Expand All @@ -107,7 +107,7 @@ def callback_detect_gcp_read_err(line):

def callback_detect_gcp_wmodule_err(line):
match_err = re.match(r'.*read_main_elements\(\): ERROR: \(\d+\): Invalid element in the configuration.*', line)
match_deb = re.match(r'.*Read_GCP\(\): DEBUG: Empty configuration for module \'gcp-pubsub\'', line)
match_deb = re.match(r'.*Read_GCP_pubsub\(\): DEBUG: Empty configuration for module \'gcp-pubsub\'', line)

if match_err:
return line
Expand Down
47 changes: 36 additions & 11 deletions deps/wazuh_testing/wazuh_testing/qa_docs/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,30 @@ predefined_values:
tags:
- active_response
- agentd
- alas_feeds
- alerts
- analysisd
- api
- ar_analysisd
- ar_execd
- archlinux
- archlinux_feeds
- auditd
- audit_keys
- audit_rules
- authd
- aws
- brute_force_attack
- cache
- canonical
- canonical_feeds
- cluster
- config
- config
- cors
- cpe
- debian
- debian_feeds
- dos_attack
- download
- enrollment
Expand All @@ -214,61 +223,77 @@ predefined_values:
- fim_multiple_dirs
- fim_nodiff
- fim_prefilter_cmd
- fim_report_changes
- fim_process_priority
- fim_recursion_level
- fim_restrict
- fim_scan
- fim_skip
- fim_stats_integrity_sync
- fim_tags
- fim_timezone_changes
- fim_wildcards_complex
- fim_windows_audit_interval
- fim_registry_ambiguous_confs
- fim_registry_basic_usage
- fim_registry_checks
- fim_registry_ignore
- fim_registry_nodiff
- fim_registry_file_limit
- fim_registry_ignore
- fim_registry_multiple_registries
- fim_registry_nodiff
- fim_registry_recursion_level
- fim_registry_restrict
- fim_report_changes
- fim_restrict
- fim_scan
- fim_skip
- fim_stats_integrity_sync
- fim_synchronization
- fim_tags
- fim_timezone_changes
- fim_wildcards_complex
- fim_windows_audit_interval
- gcloud
- github
- integrity
- interval
- invalid
- keys
- key_polling
- limits
- logcollector
- logging
- logs
- logs
- logtest
- man_in_the_middle
- master
- maximum
- mitre
- msu
- msu_feeds
- nvd
- office365
- on start
- oval
- pull
- rbac
- realtime
- redhat
- redhat_feeds
- remote
- remoted
- rids
- rootcheck
- rules
- scan
- scan_results
- schedule
- scheduled
- settings
- simulator
- ssl
- stats_file
- system_inventory
- time_travel
- token
- vulnerability
- vulnerability_detector
- wazuh_db
- wdb_socket
- week_day
- who_data
- windows
- worker
- wpk
30 changes: 17 additions & 13 deletions deps/wazuh_testing/wazuh_testing/scripts/simulate_api_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,7 @@ def main():
HOST = configuration['remote']['host']
PORT = configuration['remote']['port']

if configuration['kibana']['enabled']:
kibana_logger = CustomLogger('kibana_thread', file_path=options.log_path, foreground=options.foreground,
tag='Kibana').get_logger()
try:
kibana_thread = APISimulator(HOST, PORT, request_template=options.kibana_template,
frequency=options.frequency, external_logger=kibana_logger)
kibana_thread.start()
sleep(options.time)
kibana_thread.shutdown()
except Exception as kibana_exception:
kibana_logger.error(f'Unhandled exception: {kibana_exception}')
thread_list = []

if configuration['extra_load']['enabled']:
extra_logger = CustomLogger('extra_thread', file_path=options.log_path, foreground=options.foreground,
Expand All @@ -62,11 +52,25 @@ def main():
extra_load_thread = APISimulator(HOST, PORT, request_template=options.extraload_template,
request_percentage=request_percentage, external_logger=extra_logger)
extra_load_thread.start()
sleep(options.time)
extra_load_thread.shutdown()
thread_list.append(extra_load_thread)
except Exception as extra_exception:
extra_logger.error(f'Unhandled exception: {extra_exception}')

if configuration['kibana']['enabled']:
kibana_logger = CustomLogger('kibana_thread', file_path=options.log_path, foreground=options.foreground,
tag='Kibana').get_logger()
try:
kibana_thread = APISimulator(HOST, PORT, request_template=options.kibana_template,
frequency=options.frequency, external_logger=kibana_logger)
kibana_thread.start()
thread_list.append(kibana_thread)
except Exception as kibana_exception:
kibana_logger.error(f'Unhandled exception: {kibana_exception}')

sleep(options.time)
for thread in thread_list:
thread.shutdown()


if __name__ == '__main__':
main()
Loading

0 comments on commit 0afa402

Please sign in to comment.