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

Changed wazuh-agent service start from install test to registration test #5762

Merged
merged 7 commits into from
Oct 8, 2024

Conversation

hossam1522
Copy link
Member

Description

This pull request is based on #5741. As said in #5741 (comment), the service cannot be started in the installation test because there is no manager IP assigned. Therefore, the solution is to start the service in the registration test, after adding the manager IP to the agent configuration.

After doing that and running the test, you can see in the logs that the message reported in the issue no longer appears:


Testing performed

Validation Jenkins Local OS Commit Notes
⚫⚫ 🟢 🟢 Ubuntu 24.04 5584a69 Nothing to highlight

Copy link
Member

@rauldpm rauldpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes affect Windows and macOS systems, please run a complete agent tier

@hossam1522
Copy link
Member Author

A complete agent tier test was executed correctly:

Log:

Template:

Copy link
Member

@joaquinsgi joaquinsgi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gj! But it is necessary to update the CHANGELOG.md

joaquinsgi
joaquinsgi previously approved these changes Sep 26, 2024
Copy link
Member

@juliamagan juliamagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GJ! Please, solve the conflicts.

Copy link
Member

@juliamagan juliamagan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing the test, I am a bit concerned about the implementation of this one:

  1. It was failing to start but was not reported as failed.
  2. The install starts the agent without registering it, which is why it fails. But also, it then checks for stopped, so it wouldn't make sense for it to start it, or for the check to be stopped.
  3. The state check is too wide, it should check that the status is correct for all valid statuses, it would even be expected statuses instead of valid statuses.
  4. The registration function is modified, which is not used by this test and this modification could affect where it is being used, since restart has been changed by start, and if the agent is already started, it is not going to be registered.

Please, let's take a quick look at this test, see what status is expected, see why the error is not being handled well and make the necessary modifications.

@hossam1522
Copy link
Member Author

Everything related to starting the agent and checking its status has been removed from the installation function since, as no manager has been registered, it will fail to start causing the log reported in this issue. However, even if it fails in that part, the test does not report any failure and passes as valid, which should not happen and for which the following issue has been opened:

It has been considered most logical to start the agent after registering a manager. For this reason, the restart in the registration function has been modified by a start, because previously it was not possible to start the agent because there was no associated manager.

As this has been modified for Linux and MacOS only (The change that was made in the Windows test was tested on #5762 (comment)), a build has been run to demonstrate that both the installation test and the registration test work perfectly and that the erroneous log reported in the issue no longer appears.

rauldpm
rauldpm previously approved these changes Oct 7, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Julia Magán <80041853+juliamagan@users.noreply.github.com>
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Julia Magán <80041853+juliamagan@users.noreply.github.com>
@juliamagan juliamagan merged commit a85b6cf into 4.10.0 Oct 8, 2024
@juliamagan juliamagan deleted the bug/5741-error-at-agent-start branch October 8, 2024 14:46
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.

Job for wazuh-agent.service failed because message was found during agent testing
4 participants