Skip to content

Backport(v1.16) test: fix unstable buffer test (#4849) #4851

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

Merged
merged 1 commit into from
Mar 6, 2025
Merged

Conversation

daipom
Copy link
Contributor

@daipom daipom commented Mar 6, 2025

Which issue(s) this PR fixes:

What this PR does / why we need it:
Fix occasional test failure:
https://github.com/fluent/fluentd/actions/runs/13650069134/job/38156420830?pr=4846#step:6:4985

The max size of the buffer queue is 1 by default. So, try_flush will be called with flush_thread_interval, not flush_thread_burst_interval.

The previous test code assumes that the interval is 0.1s, but it was actually 1s.
This would be the cause of the occasional failure.

test: #write is called per value combination of variables, per flush_interval & chunk sizes, and buffer chunk is
purged(BufferedOutputTest::buffered output feature with variables):
            assert{ @i.buffer.stage.size == 0 }
                    |  |      |     |    |
                    |  |      |     |    false
                    |  |      |     1
                    |  |      {...}
                    |  #<...>
                    #<...>

/Users/runner/work/fluentd/fluentd/test/plugin/test_output_as_buffered.rb:1459:in `block (2 levels) in <class:BufferedOutputTest>'
         1456:       @i.enqueue_thread_wait
         1457:       @i.flush_thread_wakeup
         1458:
      => 1459:       assert{ @i.buffer.stage.size == 0 }
         1460:
         1461:       waiting(4) do
         1462:         Thread.pass until @i.write_count > 1

Docs Changes:
Not needed.

Release Note:
Not needed.

**Which issue(s) this PR fixes**:
None.

**What this PR does / why we need it**:
Fix occasional test failure:
https://github.com/fluent/fluentd/actions/runs/13650069134/job/38156420830?pr=4846#step:6:4985

The max size of the buffer queue is `1` by default.
So, `try_flush` will be called with `flush_thread_interval`, not
`flush_thread_burst_interval`.

The previous test code assumes that the interval is 0.1s, but it was
actually 1s.
This would be the cause of the occasional failure.

test: #write is called per value combination of variables, per
flush_interval & chunk sizes, and buffer chunk is
purged(BufferedOutputTest::buffered output feature with variables):
            assert{ @i.buffer.stage.size == 0 }
                    |  |      |     |    |
                    |  |      |     |    false
                    |  |      |     1
                    |  |      {...}
                    |  #<...>
                    #<...>

/Users/runner/work/fluentd/fluentd/test/plugin/test_output_as_buffered.rb:1459:in
`block (2 levels) in <class:BufferedOutputTest>'
         1456:       @i.enqueue_thread_wait
         1457:       @i.flush_thread_wakeup
         1458:
      => 1459:       assert{ @i.buffer.stage.size == 0 }
         1460:
         1461:       waiting(4) do
         1462:         Thread.pass until @i.write_count > 1

**Docs Changes**:
Not needed.

**Release Note**:
Not needed.

Signed-off-by: Daijiro Fukuda <fukuda@clear-code.com>
@daipom daipom added this to the v1.16.8 milestone Mar 6, 2025
@daipom daipom requested a review from Watson1978 March 6, 2025 04:34
@daipom daipom added the CI Test/CI issues label Mar 6, 2025
@daipom daipom merged commit 9e93a65 into v1.16 Mar 6, 2025
16 checks passed
@daipom daipom deleted the backport-4849 branch March 6, 2025 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Test/CI issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants