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

[Elastic Agent] Fixed status reporting #25584

Merged
merged 5 commits into from
May 12, 2021

Conversation

michalpristas
Copy link
Contributor

What does this PR do?

Fixed some issues discovered on testing.
First one is not to use overwrites when in standalone mode second one is that status code was always 200. (written after body)

Why is it important?

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.next.asciidoc or CHANGELOG-developer.next.asciidoc.

@michalpristas michalpristas self-assigned this May 6, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels May 6, 2021
@elasticmachine
Copy link
Collaborator

elasticmachine commented May 6, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #25584 updated

  • Start Time: 2021-05-12T09:17:45.669+0000

  • Duration: 88 min 26 sec

  • Commit: 01c2499

Test stats 🧪

Test Results
Failed 0
Passed 6885
Skipped 23
Total 6908

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 6885
Skipped 23
Total 6908

Copy link
Contributor

@kvch kvch left a comment

Choose a reason for hiding this comment

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

LGTM, I haven't tested it yet.

@kvch
Copy link
Contributor

kvch commented May 6, 2021

Also, test failure is going to be fixed by: #25587

@kvch
Copy link
Contributor

kvch commented May 6, 2021

Tested, works well.

switch e := err.(type) {
case apiError:
w.WriteHeader(e.Status())
default:
w.WriteHeader(http.StatusInternalServerError)

}

writeResponse(w, unexpectedErrorWithReason(err.Error()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible to add a unit test for this code path? Having a unit test would have been an easy way to catch this.

@michalpristas michalpristas added the needs_backport PR is waiting to be backported to other branches. label May 10, 2021
@michalpristas michalpristas merged commit 7d75d02 into elastic:master May 12, 2021
michalpristas added a commit to michalpristas/beats that referenced this pull request May 12, 2021
michalpristas added a commit to michalpristas/beats that referenced this pull request May 12, 2021
michalpristas added a commit that referenced this pull request May 14, 2021
Cherry-pick #25584 to 7.x: Fixed status reporting  (#25684)
michalpristas added a commit that referenced this pull request May 14, 2021
[Elastic Agent] Fixed status reporting (#25584)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs_backport PR is waiting to be backported to other branches. Team:Elastic-Agent Label for the Agent team v7.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants