Description
Describe the bug
Some tests are asserting log messages as follows.
We should fix these tests.
- Use
shutdown: false
and manually dod.instance_shutdown
- Take logs from
Driver::instance
fluentd/test/plugin/test_in_forward.rb
Lines 186 to 203 in 206b46b
We should not use this approach.
The log messages of the instance will be cleared after the shutdown, but we can still take log messages from Driver::logs
.
So we should use Driver::logs
and should not use shutdown: false
for this purpose.
Note: Driver::logs
is the same instance as instance.log.out.logs
(= instance.log.logs
), but reset
will not clear it, just re-assign the new list to DummyLogDevice
. So we can use Driver::logs
after the shutdown.
fluentd/lib/fluent/test/driver/base_owner.rb
Lines 30 to 31 in 206b46b
fluentd/lib/fluent/test/log.rb
Lines 32 to 34 in 206b46b
To Reproduce
None.
Expected behavior
None.
Your Environment
Not related.
Your Configuration
Not related.
Your Error Log
Not related.
Additional context
The document also says we should use Driver::logs
.
https://docs.fluentd.org/plugin-development/plugin-test-code#tests-for-logs