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

Add unit tests for self restart #547

Open
wants to merge 1 commit into
base: enhancement/77-add-support-agent-self-restarting
Choose a base branch
from

Conversation

lchico
Copy link
Member

@lchico lchico commented Jan 25, 2025

Related issue
#438

Description

This PR introduces tests for the restart handler.

Tests

cd build/agent/restart_handler/tests/ && ctest -VV
UpdateCTestConfiguration  from :/root/wazuh-agent/build/agent/restart_handler/tests/DartConfiguration.tcl
UpdateCTestConfiguration  from :/root/wazuh-agent/build/agent/restart_handler/tests/DartConfiguration.tcl
Test project /root/wazuh-agent/build/agent/restart_handler/tests
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
    Start 1: RestartHandler

1: Test command: /root/wazuh-agent/build/agent/restart_handler/tests/restart_handler_test
1: Working Directory: /root/wazuh-agent/build/agent/restart_handler/tests
1: Test timeout computed to be: 10000000
1: [==========] Running 5 tests from 3 test suites.
1: [----------] Global test environment set-up.
1: [----------] 2 tests from TestUsingSystemctl
1: [ RUN      ] TestUsingSystemctl.ReturnsTrueWhenSystemctlIsAvailable
1: [       OK ] TestUsingSystemctl.ReturnsTrueWhenSystemctlIsAvailable (1 ms)
1: [ RUN      ] TestUsingSystemctl.ReturnsFalseWhenSystemctlIsNotAvailable
1: [       OK ] TestUsingSystemctl.ReturnsFalseWhenSystemctlIsNotAvailable (0 ms)
1: [----------] 2 tests from TestUsingSystemctl (1 ms total)
1: 
1: [----------] 2 tests from StopAgentTest
1: [ RUN      ] StopAgentTest.GratefullyStop
1: [       OK ] StopAgentTest.GratefullyStop (2000 ms)
1: [ RUN      ] StopAgentTest.ForceStop
1: [       OK ] StopAgentTest.ForceStop (5000 ms)
1: [----------] 2 tests from StopAgentTest (7001 ms total)
1: 
1: [----------] 1 test from RestartWithForkTest
1: [ RUN      ] RestartWithForkTest.ShouldRestartUsingFork
1: [       OK ] RestartWithForkTest.ShouldRestartUsingFork (0 ms)
1: [----------] 1 test from RestartWithForkTest (0 ms total)
1: 
1: [----------] Global test environment tear-down
1: [==========] 5 tests from 3 test suites ran. (7003 ms total)
1: [  PASSED  ] 5 tests.
1/1 Test #1: RestartHandler ...................   Passed   11.01 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =  11.01 sec

@lchico lchico changed the title Enhancement/438 add unit tests for self restart Add unit tests for self restart Jan 25, 2025
@lchico lchico force-pushed the enhancement/438-add-unit-tests-for-self-restart branch from 2c86342 to 739b694 Compare January 25, 2025 02:04
@lchico lchico changed the base branch from test/77-add-support-agent-self-restarting to enhancement/77-add-support-agent-self-restarting January 25, 2025 02:06
@lchico lchico force-pushed the enhancement/438-add-unit-tests-for-self-restart branch from 739b694 to c071f9a Compare January 25, 2025 02:51
@lchico lchico linked an issue Jan 25, 2025 that may be closed by this pull request
3 tasks
@lchico lchico force-pushed the enhancement/438-add-unit-tests-for-self-restart branch 2 times, most recently from f90b8d0 to bcdf1d4 Compare January 25, 2025 03:09
@lchico lchico force-pushed the enhancement/77-add-support-agent-self-restarting branch 3 times, most recently from 1bdd2eb to 139b28a Compare January 25, 2025 15:41
@lchico lchico force-pushed the enhancement/438-add-unit-tests-for-self-restart branch 2 times, most recently from eb7f229 to d28afc8 Compare January 25, 2025 16:46
@lchico lchico force-pushed the enhancement/77-add-support-agent-self-restarting branch from 139b28a to 3ba8fa9 Compare January 25, 2025 16:48
@lchico lchico force-pushed the enhancement/438-add-unit-tests-for-self-restart branch from d28afc8 to 1206e65 Compare January 26, 2025 02:00
@lchico lchico force-pushed the enhancement/77-add-support-agent-self-restarting branch from 3ba8fa9 to 98ce958 Compare January 26, 2025 02:09
@lchico lchico force-pushed the enhancement/438-add-unit-tests-for-self-restart branch 2 times, most recently from 0f5a9b3 to ca4195b Compare January 26, 2025 02:19
@lchico lchico changed the base branch from enhancement/77-add-support-agent-self-restarting to test/77-add-support-agent-self-restarting January 26, 2025 02:21
@lchico lchico changed the base branch from test/77-add-support-agent-self-restarting to enhancement/77-add-support-agent-self-restarting January 26, 2025 02:22
@lchico lchico force-pushed the enhancement/77-add-support-agent-self-restarting branch from 98ce958 to 74ecea0 Compare January 26, 2025 02:31
@lchico lchico force-pushed the enhancement/438-add-unit-tests-for-self-restart branch from ca4195b to dc235af Compare January 26, 2025 02:32
@lchico lchico changed the base branch from enhancement/77-add-support-agent-self-restarting to master January 26, 2025 02:42
@lchico lchico changed the base branch from master to enhancement/77-add-support-agent-self-restarting January 26, 2025 02:42
@lchico lchico force-pushed the enhancement/438-add-unit-tests-for-self-restart branch from dc235af to 96617d6 Compare January 26, 2025 02:52
@lchico lchico marked this pull request as ready for review January 26, 2025 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for agent self-restarting: Testing Phase
1 participant