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

Unit tests for content manager don't pass #22571

Closed
cborla opened this issue Mar 15, 2024 · 4 comments
Closed

Unit tests for content manager don't pass #22571

cborla opened this issue Mar 15, 2024 · 4 comments
Assignees
Labels
level/task type/bug Something isn't working

Comments

@cborla
Copy link
Member

cborla commented Mar 15, 2024

Wazuh version Component Install type Install method Platform Source Previous
4.8.0-beta4 Unit tests Manager Sources Ubuntu 22 #22527 #21819

Commands

make deps
make TARGET=server DEBUG=1 TEST=1
ctest -j4

Result

5/11 Test  #5: content_manager_component_tests .........***Exception: SegFault  0.17 sec
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL

result-ctest.txt

@cborla
Copy link
Member Author

cborla commented Mar 15, 2024

Running any test with gdb does not fail me, but without gdb any test if I run it 4 or 5 times I get the message AddressSanitizer:DEADLYSIGNAL
github example

# ./wazuh_modules/github/test_wm_github 
[==========] tests_functionality: Running 21 test(s).
[ RUN      ] test_github_main_fail_StartMQ
[       OK ] test_github_main_fail_StartMQ
[ RUN      ] test_github_main_enable
.
.
.
[       OK ] test_error_api_token_1
[ RUN      ] test_error_event_type_1
[       OK ] test_error_event_type_1
[==========] tests_configuration: 28 test(s) run.
[  PASSED  ] 28 test(s).

# ./wazuh_modules/github/test_wm_github 
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer:DEADLYSIGNAL

@wazuhci wazuhci moved this from Triage to Backlog in Release 4.8.0 Mar 18, 2024
@wazuhci wazuhci moved this from Backlog to In progress in Release 4.8.0 Mar 27, 2024
@pereyra-m
Copy link
Member

Hello @cborla !

I was unable to reproduce this issue in my environment. I compiled and run the tests manually and using the wazuh-tools script.

You've shown that this error also happens in other tests, like test_wm_github, so it might not be a problem of the content manager specifically.
Can you provide more details of the environment? Compiler version, etc.

Update

@Dwordcito found these related issues

actions/runner-images#9491 (comment)
actions/runner-images#9524 (comment)

@Dwordcito
Copy link
Member

@cborla please use the workaround explained in the issue: sudo sysctl vm.mmap_rnd_bits=28 and try again.

If the problem disappears please close the issue as not planned.

@wazuhci wazuhci moved this from In progress to Blocked in Release 4.8.0 Apr 2, 2024
@cborla
Copy link
Member Author

cborla commented Apr 3, 2024

100% tests passed 🟢

After applying the changes suggested in the previous comment, the tests do not present errors when executed.

# sudo sysctl vm.mmap_rnd_bits=28
vm.mmap_rnd_bits = 28
Runnig ctest
# ctest

Test project /home/wazuh/src/unit_tests/build

        Start   1: test_analysisd_syscheck

  1/170 Test   #1: test_analysisd_syscheck .................................   Passed    0.12 sec

        Start   2: test_cleanevent

  2/170 Test   #2: test_cleanevent .........................................   Passed    0.08 sec

        Start   3: test_dbsync

  3/170 Test   #3: test_dbsync .............................................   Passed    0.09 sec

        Start   4: test_exec

  4/170 Test   #4: test_exec ...............................................   Passed    0.09 sec

        Start   5: test_log

  5/170 Test   #5: test_log ................................................   Passed    0.08 sec

        Start   6: test_labels

  6/170 Test   #6: test_labels .............................................   Passed    0.08 sec

        Start   7: test_mitre

  7/170 Test   #7: test_mitre ..............................................   Passed    0.04 sec

        Start   8: test_rules

  8/170 Test   #8: test_rules ..............................................   Passed    0.09 sec

        Start   9: test_same_different_loop

  9/170 Test   #9: test_same_different_loop ................................   Passed    0.09 sec

        Start  10: test_logtest

 10/170 Test  #10: test_logtest ............................................   Passed    0.09 sec

        Start  11: test_logtest-config

 11/170 Test  #11: test_logtest-config .....................................   Passed    0.03 sec

        Start  12: test_decoder_list

 12/170 Test  #12: test_decoder_list .......................................   Passed    0.04 sec

        Start  13: test_decode-xml

 13/170 Test  #13: test_decode-xml .........................................   Passed    0.08 sec

        Start  14: test_lists_list

 14/170 Test  #14: test_lists_list .........................................   Passed    0.05 sec

        Start  15: test_rule_list

 15/170 Test  #15: test_rule_list ..........................................   Passed    0.04 sec

        Start  16: test_eventinfo_list

 16/170 Test  #16: test_eventinfo_list .....................................   Passed    0.04 sec

        Start  17: test_logmsg

 17/170 Test  #17: test_logmsg .............................................   Passed    0.05 sec

        Start  18: test_decoder_rootcheck

 18/170 Test  #18: test_decoder_rootcheck ..................................   Passed    0.09 sec

        Start  19: test_decoder_syscollector

 19/170 Test  #19: test_decoder_syscollector ...............................   Passed    0.13 sec

        Start  20: test_decoder_winevtchannel

 20/170 Test  #20: test_decoder_winevtchannel ..............................   Passed    0.09 sec

        Start  21: test_decoder_winevtchannel_input

 21/170 Test  #21: test_decoder_winevtchannel_input ........................   Passed    0.10 sec

        Start  22: test_analysis-state

 22/170 Test  #22: test_analysis-state .....................................   Passed    0.09 sec

        Start  23: test_asyscom

 23/170 Test  #23: test_asyscom ............................................   Passed    0.08 sec

        Start  24: test_limits

 24/170 Test  #24: test_limits .............................................   Passed    0.03 sec

        Start  25: test_manager

 25/170 Test  #25: test_manager ............................................   Passed    0.11 sec

        Start  26: test_secure

 26/170 Test  #26: test_secure .............................................   Passed    0.09 sec

        Start  27: test_netbuffer

 27/170 Test  #27: test_netbuffer ..........................................   Passed    0.07 sec

        Start  28: test_sendmsg

 28/170 Test  #28: test_sendmsg ............................................   Passed    0.07 sec

        Start  29: test_remote-config

 29/170 Test  #29: test_remote-config ......................................   Passed    0.04 sec

        Start  30: test_syslogtcp

 30/170 Test  #30: test_syslogtcp ..........................................   Passed    0.08 sec

        Start  31: test_remote-state

 31/170 Test  #31: test_remote-state .......................................   Passed    0.08 sec

        Start  32: test_remcom

 32/170 Test  #32: test_remcom .............................................   Passed    0.08 sec

        Start  33: test_wdb_integrity

 33/170 Test  #33: test_wdb_integrity ......................................   Passed    0.06 sec

        Start  34: test_wdb_fim

 34/170 Test  #34: test_wdb_fim ............................................   Passed    0.05 sec

        Start  35: test_wdb_parser

 35/170 Test  #35: test_wdb_parser .........................................   Passed    0.07 sec

        Start  36: test_wdb_global_parser

 36/170 Test  #36: test_wdb_global_parser ..................................   Passed    0.08 sec

        Start  37: test_wdb_global

 37/170 Test  #37: test_wdb_global .........................................   Passed    0.22 sec

        Start  38: test_wdb_agents

 38/170 Test  #38: test_wdb_agents .........................................   Passed    0.04 sec

        Start  39: test_wdb_global_helpers

 39/170 Test  #39: test_wdb_global_helpers .................................   Passed    0.08 sec

        Start  40: test_wdb_agents_helpers

 40/170 Test  #40: test_wdb_agents_helpers .................................   Passed    0.04 sec

        Start  41: test_wdb

 41/170 Test  #41: test_wdb ................................................   Passed    0.06 sec

        Start  42: test_wdb_upgrade

 42/170 Test  #42: test_wdb_upgrade ........................................   Passed    0.05 sec

        Start  43: test_wdb_metadata

 43/170 Test  #43: test_wdb_metadata .......................................   Passed    0.06 sec

        Start  44: test_wdb_task_parser

 44/170 Test  #44: test_wdb_task_parser ....................................   Passed    0.06 sec

        Start  45: test_wdb_rootcheck

 45/170 Test  #45: test_wdb_rootcheck ......................................   Passed    0.07 sec

        Start  46: test_wdb_syscollector

 46/170 Test  #46: test_wdb_syscollector ...................................   Passed    0.07 sec

        Start  47: test_wdb_task

 47/170 Test  #47: test_wdb_task ...........................................   Passed    0.06 sec

        Start  48: test_wdb_delta_event

 48/170 Test  #48: test_wdb_delta_event ....................................   Passed    0.05 sec

        Start  49: test_wazuh_db-config

 49/170 Test  #49: test_wazuh_db-config ....................................   Passed    0.06 sec

        Start  50: test_wazuh_db_state

 50/170 Test  #50: test_wazuh_db_state .....................................   Passed    0.07 sec

        Start  51: test_wdb_com

 51/170 Test  #51: test_wdb_com ............................................   Passed    0.05 sec

        Start  52: test_wdb_pool

 52/170 Test  #52: test_wdb_pool ...........................................   Passed    0.06 sec

        Start  53: test_auth_parse

 53/170 Test  #53: test_auth_parse .........................................   Passed    0.05 sec

        Start  54: test_auth_validate

 54/170 Test  #54: test_auth_validate ......................................   Passed    0.07 sec

        Start  55: test_auth_add

 55/170 Test  #55: test_auth_add ...........................................   Passed    0.05 sec

        Start  56: test_ssl

 56/170 Test  #56: test_ssl ................................................   Passed    0.05 sec

        Start  57: test_auth_key_request

 57/170 Test  #57: test_auth_key_request ...................................   Passed    0.07 sec

        Start  58: test_auth

 58/170 Test  #58: test_auth ...............................................   Passed    0.06 sec

        Start  59: test_generate_cert

 59/170 Test  #59: test_generate_cert ......................................   Passed    2.76 sec

        Start  60: test_authd-config

 60/170 Test  #60: test_authd-config .......................................   Passed    0.02 sec

        Start  61: test_msgs

 61/170 Test  #61: test_msgs ...............................................   Passed    0.04 sec

        Start  62: test_keys

 62/170 Test  #62: test_keys ...............................................   Passed    0.03 sec

        Start  63: test_sha1_op

 63/170 Test  #63: test_sha1_op ............................................   Passed    0.04 sec

        Start  64: test_blowfish_op

 64/170 Test  #64: test_blowfish_op ........................................   Passed    0.03 sec

        Start  65: test_md5_op

 65/170 Test  #65: test_md5_op .............................................   Passed    0.07 sec

        Start  66: test_md5_sha1_op

 66/170 Test  #66: test_md5_sha1_op ........................................   Passed    0.04 sec

        Start  67: test_md5_sha1_sha256_op

 67/170 Test  #67: test_md5_sha1_sha256_op .................................   Passed    0.05 sec

        Start  68: test_sha256_op

 68/170 Test  #68: test_sha256_op ..........................................   Passed    0.04 sec

        Start  69: test_sha512_op

 69/170 Test  #69: test_sha512_op ..........................................   Passed    0.05 sec

        Start  70: test_wm_aws

 70/170 Test  #70: test_wm_aws .............................................   Passed    0.08 sec

        Start  71: test_wm_azure

 71/170 Test  #71: test_wm_azure ...........................................   Passed    0.09 sec

        Start  72: test_wm_ciscat

 72/170 Test  #72: test_wm_ciscat ..........................................   Passed    0.09 sec

        Start  73: test_wm_command

 73/170 Test  #73: test_wm_command .........................................   Passed    0.09 sec

        Start  74: test_wm_database

 74/170 Test  #74: test_wm_database ........................................   Passed    0.05 sec

        Start  75: test_wm_docker

 75/170 Test  #75: test_wm_docker ..........................................   Passed    0.09 sec

        Start  76: test_wm_gcp

 76/170 Test  #76: test_wm_gcp .............................................   Passed    0.40 sec

        Start  77: test_wmodules_gcp

 77/170 Test  #77: test_wmodules_gcp .......................................   Passed    0.13 sec

        Start  78: test_wm_oscap

 78/170 Test  #78: test_wm_oscap ...........................................   Passed    0.09 sec

        Start  79: test_wm_sca

 79/170 Test  #79: test_wm_sca .............................................   Passed    0.09 sec

        Start  80: test_wmodules_scheduling

 80/170 Test  #80: test_wmodules_scheduling ................................   Passed    0.04 sec

        Start  81: test_wm_vulnerability_detection

 81/170 Test  #81: test_wm_vulnerability_detection .........................   Passed    0.11 sec

        Start  82: test_wm_task_manager

 82/170 Test  #82: test_wm_task_manager ....................................   Passed    0.07 sec

        Start  83: test_wm_task_manager_parsing

 83/170 Test  #83: test_wm_task_manager_parsing ............................   Passed    0.04 sec

        Start  84: test_wm_task_manager_commands

 84/170 Test  #84: test_wm_task_manager_commands ...........................   Passed    0.06 sec

        Start  85: test_wm_agent_upgrade

 85/170 Test  #85: test_wm_agent_upgrade ...................................   Passed    0.04 sec

        Start  86: test_wm_agent_upgrade_manager

 86/170 Test  #86: test_wm_agent_upgrade_manager ...........................   Passed    0.09 sec

        Start  87: test_wm_agent_upgrade_parsing

 87/170 Test  #87: test_wm_agent_upgrade_parsing ...........................   Passed    0.08 sec

        Start  88: test_wm_agent_upgrade_validate

 88/170 Test  #88: test_wm_agent_upgrade_validate ..........................   Passed    0.04 sec

        Start  89: test_wm_agent_upgrade_tasks

 89/170 Test  #89: test_wm_agent_upgrade_tasks .............................   Passed    0.05 sec

        Start  90: test_wm_agent_upgrade_tasks_callbacks

 90/170 Test  #90: test_wm_agent_upgrade_tasks_callbacks ...................   Passed    0.08 sec

        Start  91: test_wm_agent_upgrade_commands

 91/170 Test  #91: test_wm_agent_upgrade_commands ..........................   Passed    0.08 sec

        Start  92: test_wm_agent_upgrade_upgrades

 92/170 Test  #92: test_wm_agent_upgrade_upgrades ..........................   Passed    0.09 sec

        Start  93: test_wmodules

 93/170 Test  #93: test_wmodules ...........................................   Passed    0.07 sec

        Start  94: test_wm_control

 94/170 Test  #94: test_wm_control .........................................   Passed    0.08 sec

        Start  95: test_wm_github

 95/170 Test  #95: test_wm_github ..........................................   Passed    0.10 sec

        Start  96: test_wm_office365

 96/170 Test  #96: test_wm_office365 .......................................   Passed    0.13 sec

        Start  97: test_wm_ms_graph

 97/170 Test  #97: test_wm_ms_graph ........................................   Passed    0.13 sec

        Start  98: test_wm_osquery_already_running

 98/170 Test  #98: test_wm_osquery_already_running .........................   Passed    0.07 sec

        Start  99: test_monitord

 99/170 Test  #99: test_monitord ...........................................   Passed    0.06 sec

        Start 100: test_monitor_actions

100/170 Test #100: test_monitor_actions ....................................   Passed    0.09 sec

        Start 101: test_logcollector

101/170 Test #101: test_logcollector .......................................   Passed    0.11 sec

        Start 102: test_read_multiline_regex

102/170 Test #102: test_read_multiline_regex ...............................   Passed    0.08 sec

        Start 103: test_localfile-config

103/170 Test #103: test_localfile-config ...................................   Passed    0.08 sec

        Start 104: test_state

104/170 Test #104: test_state ..............................................   Passed    0.04 sec

        Start 105: test_lccom

105/170 Test #105: test_lccom ..............................................   Passed    0.09 sec

        Start 106: test_macos_log

106/170 Test #106: test_macos_log ..........................................   Passed    0.06 sec

        Start 107: test_read_macos

107/170 Test #107: test_read_macos .........................................   Passed    0.08 sec

        Start 108: test_read_multiline

108/170 Test #108: test_read_multiline .....................................   Passed    0.08 sec

        Start 109: test_execd

109/170 Test #109: test_execd ..............................................   Passed    0.03 sec

        Start 110: test_get_command_by_name

110/170 Test #110: test_get_command_by_name ................................   Passed    0.03 sec

        Start 111: test_integrator

111/170 Test #111: test_integrator .........................................   Passed    0.04 sec

        Start 112: test_manage_keys

112/170 Test #112: test_manage_keys ........................................   Passed    0.05 sec

        Start 113: test_printtable

113/170 Test #113: test_printtable .........................................   Passed    0.05 sec

        Start 114: test_csyslogd

114/170 Test #114: test_csyslogd ...........................................   Passed    0.04 sec

        Start 115: test_syscom

115/170 Test #115: test_syscom .............................................   Passed    0.04 sec

        Start 116: test_fim_diff_changes

116/170 Test #116: test_fim_diff_changes ...................................   Passed    0.07 sec

        Start 117: test_run_realtime

117/170 Test #117: test_run_realtime .......................................   Passed    0.10 sec

        Start 118: test_config

118/170 Test #118: test_config .............................................   Passed    0.12 sec

        Start 119: test_syscheck

119/170 Test #119: test_syscheck ...........................................   Passed    0.08 sec

        Start 120: test_run_check

120/170 Test #120: test_run_check ..........................................   Passed    0.08 sec

        Start 121: test_create_db

121/170 Test #121: test_create_db ..........................................   Passed    0.11 sec

        Start 122: test_audit_healthcheck

122/170 Test #122: test_audit_healthcheck ..................................   Passed    0.07 sec

        Start 123: test_audit_rule_handling

123/170 Test #123: test_audit_rule_handling ................................   Passed    0.07 sec

        Start 124: test_syscheck_audit

124/170 Test #124: test_syscheck_audit .....................................   Passed    0.10 sec

        Start 125: test_audit_parse

125/170 Test #125: test_audit_parse ........................................   Passed    0.10 sec

        Start 126: test_list_op

126/170 Test #126: test_list_op ............................................   Passed    0.06 sec

        Start 127: test_file_op

127/170 Test #127: test_file_op ............................................   Passed    0.04 sec

        Start 128: test_integrity_op

128/170 Test #128: test_integrity_op .......................................   Passed    0.03 sec

        Start 129: test_rbtree_op

129/170 Test #129: test_rbtree_op ..........................................   Passed    0.04 sec

        Start 130: test_validate_op

130/170 Test #130: test_validate_op ........................................   Passed    0.05 sec

        Start 131: test_string_op

131/170 Test #131: test_string_op ..........................................   Passed    0.03 sec

        Start 132: test_expression

132/170 Test #132: test_expression .........................................   Passed    0.04 sec

        Start 133: test_version_op

133/170 Test #133: test_version_op .........................................   Passed    0.07 sec

        Start 134: test_queue_op

134/170 Test #134: test_queue_op ...........................................   Passed    0.03 sec

        Start 135: test_queue_linked_op

135/170 Test #135: test_queue_linked_op ....................................   Passed    0.04 sec

        Start 136: test_agent_op

136/170 Test #136: test_agent_op ...........................................   Passed    0.05 sec

        Start 137: test_enrollment_op

137/170 Test #137: test_enrollment_op ......................................   Passed    0.09 sec

        Start 138: test_time_op

138/170 Test #138: test_time_op ............................................   Passed    0.03 sec

        Start 139: test_buffer_op

139/170 Test #139: test_buffer_op ..........................................   Passed    0.05 sec

        Start 140: test_utf8_op

140/170 Test #140: test_utf8_op ............................................   Passed    0.05 sec

        Start 141: test_log_builder

141/170 Test #141: test_log_builder ........................................   Passed    0.05 sec

        Start 142: test_custom_output_search_replace

142/170 Test #142: test_custom_output_search_replace .......................   Passed    0.03 sec

        Start 143: test_binaries_op

143/170 Test #143: test_binaries_op ........................................   Passed    0.05 sec

        Start 144: test_bzip2_op

144/170 Test #144: test_bzip2_op ...........................................   Passed    0.05 sec

        Start 145: test_schedule_scan

145/170 Test #145: test_schedule_scan ......................................   Passed    0.04 sec

        Start 146: test_rootcheck_op

146/170 Test #146: test_rootcheck_op .......................................   Passed    0.03 sec

        Start 147: test_fs_op

147/170 Test #147: test_fs_op ..............................................   Passed    0.03 sec

        Start 148: test_wazuhdb_op

148/170 Test #148: test_wazuhdb_op .........................................   Passed    0.03 sec

        Start 149: test_syscheck_op

149/170 Test #149: test_syscheck_op ........................................   Passed    0.10 sec

        Start 150: test_json_op

150/170 Test #150: test_json_op ............................................   Passed    0.04 sec

        Start 151: test_audit_op

151/170 Test #151: test_audit_op ...........................................   Passed    0.05 sec

        Start 152: test_privsep_op

152/170 Test #152: test_privsep_op .........................................   Passed    0.06 sec

        Start 153: test_mq_op

153/170 Test #153: test_mq_op ..............................................   Passed    0.06 sec

        Start 154: test_remoted_op

154/170 Test #154: test_remoted_op .........................................   Passed    0.05 sec

        Start 155: test_json-queue

155/170 Test #155: test_json-queue .........................................   Passed    0.04 sec

        Start 156: test_bqueue

156/170 Test #156: test_bqueue .............................................   Passed    0.04 sec

        Start 157: test_atomic

157/170 Test #157: test_atomic .............................................   Passed    0.06 sec

        Start 158: test_url

158/170 Test #158: test_url ................................................   Passed    0.05 sec

        Start 159: test_sysinfo_utils

159/170 Test #159: test_sysinfo_utils ......................................   Passed    0.04 sec

        Start 160: test_rwlock_op

160/170 Test #160: test_rwlock_op ..........................................   Passed    0.10 sec

        Start 161: test_os_xml

161/170 Test #161: test_os_xml .............................................   Passed    0.10 sec

        Start 162: test_os_regex

162/170 Test #162: test_os_regex ...........................................   Passed    0.04 sec

        Start 163: test_os_regex_match

163/170 Test #163: test_os_regex_match .....................................   Passed    0.05 sec

        Start 164: test_os_regex_execute

164/170 Test #164: test_os_regex_execute ...................................   Passed    0.08 sec

        Start 165: test_os_zlib

165/170 Test #165: test_os_zlib ............................................   Passed    0.04 sec

        Start 166: test_client-config_validate_ipv6_link_local_interface

166/170 Test #166: test_client-config_validate_ipv6_link_local_interface ...   Passed    0.08 sec

        Start 167: test_indexer

167/170 Test #167: test_indexer ............................................   Passed    0.05 sec

        Start 168: test_os_net

168/170 Test #168: test_os_net .............................................   Passed    0.05 sec

        Start 169: test_fluentd_forwarder

169/170 Test #169: test_fluentd_forwarder ..................................   Passed    0.07 sec

        Start 170: test_active-response

170/170 Test #170: test_active-response ....................................   Passed    0.04 sec



100% tests passed, 0 tests failed out of 170

@Dwordcito Dwordcito closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2024
@wazuhci wazuhci moved this from Blocked to Done in Release 4.8.0 Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task type/bug Something isn't working
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants