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

[8.15](backport #5345) Improve watcher and TestWatcher_AgentErrorQuick logs #5357

Merged
merged 8 commits into from
Sep 9, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Aug 26, 2024

What does this PR do?

It improves the watcher logs and prints the logs if TestWatcher_AgentErrorQuick fails.
If the test would fail, the logs would be like the following:

❯ go test -run TestWatcher_AgentErrorQuick ./internal/pkg/agent/application/upgrade/
--- FAIL: TestWatcher_AgentErrorQuick (1.00s)
    watcher_test.go:287: [info] Agent watcher started
    watcher_test.go:287: [info] Trying to connect to agent
    watcher_test.go:287: [info] Connected to agent
    watcher_test.go:287: [debug] received state: FAILED:force failure
    watcher_test.go:287: [info] Communicating with PID 0
    watcher_test.go:287: [debug] received state: HEALTHY:healthy
    watcher_test.go:287: [error] Agent reported failure (starting failed timer): agent reported failed state: force failure
    watcher_test.go:287: [info] Agent reported healthy (failed timer stopped)
    watcher_test.go:287: [debug] received state: error: rpc error: code = DeadlineExceeded desc = context deadline exceeded
    watcher_test.go:287: [error] Lost connection: failed reading next state: rpc error: code = DeadlineExceeded desc = context deadline exceeded
FAIL
FAIL	github.com/elastic/elastic-agent/internal/pkg/agent/application/upgrade	1.351s
FAIL

Why is it important?

TestWatcher_AgentErrorQuick was flaky before, but it hasn't happened again on CI. Even running it for 12 hours didn't reproduce the problem.

Checklist

  • My code follows the style guidelines of this project
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in ./changelog/fragments using the changelog tool
  • [ ] I have added an integration test or an E2E test

Disruptive User Impact

None

How to test this PR locally

make TestWatcher_AgentErrorQuick to fail by adding t.Fail() at the end of the test and then run the test.

❯ go test -count 43200 -run TestWatcher_AgentErrorQuick -timeout=0
PASS
ok      github.com/elastic/elastic-agent/internal/pkg/agent/application/upgrade 43320.474s

Related issues

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

This is an automatic backport of pull request #5345 done by [Mergify](https://mergify.com).

@mergify mergify bot requested a review from a team as a code owner August 26, 2024 09:55
@mergify mergify bot added the backport label Aug 26, 2024
@mergify mergify bot requested review from blakerouse and andrzej-stencel and removed request for a team August 26, 2024 09:55
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Aug 26, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@pierrehilbert pierrehilbert requested review from AndersonQ and removed request for blakerouse and andrzej-stencel August 26, 2024 13:15
Copy link
Contributor Author

mergify bot commented Sep 2, 2024

This pull request has not been merged yet. Could you please review and merge it @AndersonQ? 🙏

@AndersonQ AndersonQ force-pushed the mergify/bp/8.15/pr-5345 branch from d1a8af2 to 679874b Compare September 3, 2024 11:58
@AndersonQ AndersonQ enabled auto-merge (squash) September 5, 2024 09:18
Copy link
Contributor Author

mergify bot commented Sep 9, 2024

This pull request has not been merged yet. Could you please review and merge it @AndersonQ? 🙏

@AndersonQ AndersonQ merged commit fc28030 into 8.15 Sep 9, 2024
13 checks passed
@AndersonQ AndersonQ deleted the mergify/bp/8.15/pr-5345 branch September 9, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants