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

[Filebeat] fix minor unreachable code #32659

Merged
merged 1 commit into from
Sep 7, 2022
Merged

[Filebeat] fix minor unreachable code #32659

merged 1 commit into from
Sep 7, 2022

Conversation

Abirdcfly
Copy link
Contributor

Signed-off-by: Abirdcfly fp544037857@gmail.com

  • Cleanup

What does this PR do?

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.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@Abirdcfly Abirdcfly requested review from a team as code owners August 11, 2022 08:47
@Abirdcfly Abirdcfly requested review from rdner and cmacknz and removed request for a team August 11, 2022 08:47
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 11, 2022
@cla-checker-service
Copy link

cla-checker-service bot commented Aug 11, 2022

💚 CLA has been signed

@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 11, 2022

💚 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 preview

Expand to view the summary

Build stats

  • Start Time: 2022-08-11T11:28:49.014+0000

  • Duration: 75 min 4 sec

Test stats 🧪

Test Results
Failed 0
Passed 6794
Skipped 737
Total 7531

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

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

syslog change LGTM

Copy link
Contributor

@ShourieG ShourieG left a comment

Choose a reason for hiding this comment

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

@Abirdcfly Please add an error check to the os.MkdirAll call. Otherwise LGTM

Signed-off-by: Abirdcfly <fp544037857@gmail.com>
@Abirdcfly
Copy link
Contributor Author

@Abirdcfly Please add an error check to the os.MkdirAll call. Otherwise LGTM

Done for make golangci-lint happy.

@@ -793,7 +793,6 @@ func TestPriority(t *testing.T) {
ParserRFC3164([]byte(log), l)
assert.Equal(t, d, l.Priority())
})
return
Copy link
Member

@rdner rdner Aug 12, 2022

Choose a reason for hiding this comment

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

This looks suspicious and it changes how the test ran. Before it was running only once and now for 120 iterations. I think it's safer to remove the loop in order to preserve the existing logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This looks suspicious and it changes how the test run. Before it was running only once and now for 120 iterations.

Yes. IMO, that was the intent of this test, only the return statement was added by mistake

I think it's safer to remove the loop in order to preserve the existing logic.

I'm keeping an open mind on this.
I'll wait a few hours, and if no other revier has a problem with it, I'll delete the loop.
@efd6 @ShourieG @cmacknz

Copy link
Contributor

Choose a reason for hiding this comment

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

Running the loop only once is not correct IMO. The point of the test is to check that a variety of syslog priorities are properly parsed into the destination value. Testing only a single value (1) is not interesting. I'm not entirely sure why it starts at 1 and stops at 120 since it would not cost significantly more to test the exhaustive range of valid priority values.

@mergify
Copy link
Contributor

mergify bot commented Aug 16, 2022

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @Abirdcfly? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)
    To fixup this pull request, you need to add the backport labels for the needed
    branches, such as:
  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@andrewkroh andrewkroh changed the title [Heartbeat] fix minor unreachable code [Filebeat] fix minor unreachable code Aug 16, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@elasticmachine
Copy link
Collaborator

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

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 16, 2022
@epixa
Copy link
Contributor

epixa commented Sep 7, 2022

@cmacknz Are you able to take a look at this?

@cmacknz
Copy link
Member

cmacknz commented Sep 7, 2022

Didn't realize I was holding this up. Approved, and merged. Thanks!

@cmacknz cmacknz merged commit cf10d31 into elastic:main Sep 7, 2022
chrisberkhout pushed a commit that referenced this pull request Jun 1, 2023
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Filebeat Filebeat 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.

8 participants