-
Notifications
You must be signed in to change notification settings - Fork 3
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
test: don't use deprecated way of capturing logs #7
Conversation
Could you improve the title of this pull request something like |
Thanks! That is more specific and easy to understand. Fixed. |
I just rebased this branch to the latest master. |
I thought that This method is defined by this plugin in fluent-plugin-flowcounter-simple/test/helper.rb Lines 12 to 28 in 5081e88
But this is very similar to the Fluentd method and should not be used. I changed the title a little, and also fixed the |
`capture_log` is for older versions as well as the following. https://github.com/fluent/fluentd/blob/6c649d189b5cf65ccfce58f6952a31b24c775e72/lib/fluent/test/helpers.rb#L110-L122 We should use `Driver::logs` instead. In addition, this fixes the following points. * Update `helper.rb` since it was updated very long ago and there are some unnecessary codes. * Assert the entire log message (without the timestamp and the log level), since this is easier to see the diff of the expected and the actual when the assertion fails. Signed-off-by: Daijiro Fukuda <[email protected]>
I have removed unnecessary codes from |
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.
+1
Thanks for your review! |
Background
The next td-agent will embed Ruby 3.2.
I was checking each embedded plugin and noticed that this plugin has no GitHub CI.
I added CI to my forked repository, but I found the tests are unstable on Windows and macOS.
So, I created this PR first.
Following this, I would like to create a PR to add GitHub CI.
About this fix
We should use
Driver::logs
instead ofcapture_log
to fix unstable tests.capture_log
is defined by this plugin here.fluent-plugin-flowcounter-simple/test/helper.rb
Lines 12 to 28 in 5081e88
However, this is for older versions as well as the following, and this makes tests unstable.
Reproduce failing tests
Windows seems to have the highest probability of failure.