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

make filestream tests more reliable and provide debug logs #35754

Conversation

leehinman
Copy link
Contributor

What does this PR do?

  • Adds debug logs to the output of the filestream integration tests if they fail
  • replace tight loop with testify.Eventually for waitUntilOffsetInRegistry
  • increase prospector check_interval for TestFilestreamTruncateBlockedOutput
  • remove unnecessary check for number of events in TestFilestreamTruncateBlockedOutput

Why is it important?

The TestFilestreamTruncateBlockedOutput would fail regularly in CI. These changes stop the failures locally, but even if the failures occur in CI, we will now have more debug data to try and address what is failing.

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.

How to test this PR locally

cd filebeat\inputs\filestream
while go test -count 1 -run TestFilestreamTruncateBlockedOutput -tags=integration; do :;  done

Related issues

@leehinman leehinman added enhancement Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Jun 13, 2023
@leehinman leehinman requested a review from a team as a code owner June 13, 2023 01:28
@elasticmachine
Copy link
Collaborator

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

@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 Jun 13, 2023
@mergify
Copy link
Contributor

mergify bot commented Jun 13, 2023

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @leehinman? 🙏.
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

belimawr added a commit to belimawr/beats that referenced this pull request Jun 13, 2023
This commit brings the improvements from
elastic#35754 to this PR.
belimawr added a commit to belimawr/beats that referenced this pull request Jun 13, 2023
This commit brings the improvements from
elastic#35754 to this PR.
@pierrehilbert
Copy link
Collaborator

From my understanding, this one should be close in favor of #35759.
@leehinman could you do the necessary if my understanding is correct?

belimawr added a commit that referenced this pull request Jun 20, 2023
fswatcher now uses the modification time and changes in the file size
to trigger either a truncate or write event.

Other small changes:
- Fixed some log formatting issue and only log the error if it
is not `context.Canceled`
- Fixes and improves some log messages.
- Brings the improvements from
#35754 to this PR.
@mergify
Copy link
Contributor

mergify bot commented Jun 20, 2023

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b 35571_test_filestream_truncate_blocked_output upstream/35571_test_filestream_truncate_blocked_output
git merge upstream/main
git push upstream 35571_test_filestream_truncate_blocked_output

@leehinman
Copy link
Contributor Author

#35759 is merged and adopted the improvements suggested here.

@leehinman leehinman closed this Jun 20, 2023
mergify bot pushed a commit that referenced this pull request Jun 20, 2023
fswatcher now uses the modification time and changes in the file size
to trigger either a truncate or write event.

Other small changes:
- Fixed some log formatting issue and only log the error if it
is not `context.Canceled`
- Fixes and improves some log messages.
- Brings the improvements from
#35754 to this PR.

(cherry picked from commit bdb67bc)

# Conflicts:
#	filebeat/input/filestream/filestream.go
#	filebeat/input/filestream/internal/input-logfile/clean.go
belimawr added a commit that referenced this pull request Jun 21, 2023
fswatcher now uses the modification time and changes in the file size
to trigger either a truncate or write event.

Other small changes:
- Fixed some log formatting issue and only log the error if it
is not `context.Canceled`
- Fixes and improves some log messages.
- Brings the improvements from
#35754 to this PR.

(cherry picked from commit bdb67bc)

# Conflicts:
#	filebeat/input/filestream/filestream.go
#	filebeat/input/filestream/internal/input-logfile/clean.go

---------

Co-authored-by: Tiago Queiroz <[email protected]>
@leehinman leehinman deleted the 35571_test_filestream_truncate_blocked_output branch September 11, 2023 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 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.

[Filebeat] Error with registry and truncated file
3 participants