-
Notifications
You must be signed in to change notification settings - Fork 155
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
[tests][integration] fix monitoring test cases #5208
Conversation
This pull request does not have a backport label. Could you fix it @VihasMakwana? 🙏
NOTE: |
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to change -
elastic-agent/pkg/testing/fixture.go
Line 717 in 2676a3f
func (f *Fixture) ExecStatus(ctx context.Context, opts ...process.CmdOption) (AgentStatusOutput, error) { |
Reading the docstring on ExecStatus
it says it can return an output even on exit of 1. Maybe we should only return an error when we are unable to read the output, otherwise as long as some output is returned it should not be an error.
That would probably fix more tests and not just these specific tests.
Agree with Blake, the It feels like it should probably return three values: the command output, a boolean for whether agent is healthy, and an error that is only not-nil if we couldn't get or parse the output of the command. If we were to keep it the way it is, the actual bug is that there is a
|
@blakerouse @cmacknz Agree with you guys. Thanks for your inputs. i've updated the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for changing this around.
@blakerouse thanks for approving. So you know, I made a small change to combine elastic-agent/pkg/testing/fixture.go Lines 719 to 722 in 9e77ba4
|
Looks like we now have failing tests that may be related to your change. |
@blakerouse @cmacknz from the logs of failing tests, I can see that output is valid and not empty but {
"info": {
"id": "",
"version": "8.16.0",
"commit": "48bf9adae418cb043d20c18fe13cae1e6c5d05f9",
"build_time": "2024-07-30 09:58:04 +0000 UTC",
"snapshot": true,
"pid": 19922,
"unprivileged": true
},
"state": 2,
"message": "Running",
"components": [],
"FleetState": 6,
"FleetMessage": "Not enrolled into Fleet"
} ![]() I think we should check also check for func IsZero() bool {
return status.Message == "" && status.Info.Version == "" && status.Info.ID == ""
} Edit: PTAL! I've updated the condtions. |
remove logs as the test failure has been identified This reverts commit dc392b3.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for the fixes.
@@ -1243,7 +1237,7 @@ type AgentStatusOutput struct { | |||
} | |||
|
|||
func (aso *AgentStatusOutput) IsZero() bool { | |||
return aso.Info.ID == "" | |||
return aso.Info.ID == "" && aso.Message == "" && aso.Info.Version == "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes more sense actually. As IsZero
should be if nothing is outputted at all.
* chore: fix monitoring test cases * fix: update long running tests * fix: change ExecStatus and return nil * fix: update docstring, non-empty * fix: reword * fix: nit * fix: empty line * fix: join errors. * temproray logs to examine CI * Revert "temproray logs to examine CI" remove logs as the test failure has been identified This reverts commit dc392b3. * fix: update condition (cherry picked from commit 509b1cc)
* chore: fix monitoring test cases * fix: update long running tests * fix: change ExecStatus and return nil * fix: update docstring, non-empty * fix: reword * fix: nit * fix: empty line * fix: join errors. * temproray logs to examine CI * Revert "temproray logs to examine CI" remove logs as the test failure has been identified This reverts commit dc392b3. * fix: update condition (cherry picked from commit 509b1cc) Co-authored-by: VihasMakwana <121151420+VihasMakwana@users.noreply.github.com>
What does this PR do?
metricbeat
, integration test cases were failingHEALTHY
toDEGRADED
(momentarily) and again toHEALTHY
.runner.agentFixture.ExecStatus(ctx)
returned an error because of the momentarilyDEGRADED
state and it caused entire test to fail (even though it returned to aHEALTHY
state, its just how go tests function).require.Eventually
.Checklist
./changelog/fragments
using the changelog toolcloses #5209