carloea2 commented on code in PR #8282:
URL: https://github.com/apache/texera/pull/8282#discussion_r4369006168
##########
amber/src/test/python/core/util/buffer/test_timed_buffer.py:
##########
@@ -129,9 +130,30 @@ def test_exceeding_max_message_num_triggers_flush(self,
clock):
class TestFlushOnTime:
+ def test_subsecond_interval_withholds_before_boundary(self, clock):
+ buffer = TimedBuffer(max_message_num=100, max_flush_interval_in_ms=500)
+ buffer.put(_make_message())
+ _advance(clock, 0.4)
+ assert list(buffer.get()) == []
+ assert len(buffer._buffer) == 1
+
+ def test_wall_clock_jump_does_not_change_flush_interval(self, clock):
+ buffer = TimedBuffer(max_message_num=100, max_flush_interval_in_ms=500)
+ message = _make_message()
+ buffer.put(message)
+ clock.wall -= datetime.timedelta(seconds=3600)
+ _advance(clock, 0.5)
+ assert list(buffer.get()) == [message]
+
+ def test_subsecond_interval_triggers_flush(self, clock):
+ buffer = TimedBuffer(max_message_num=100, max_flush_interval_in_ms=500)
+ buffer.put(_make_message())
+ _advance(clock, 0.5)
+ assert len(list(buffer.get())) == 1
+ assert len(buffer._buffer) == 0
+
def test_elapsed_interval_triggers_flush(self, clock):
- # Interval of 2000ms -> 2.0s threshold. timedelta.seconds is an
- # integer, so 3 whole seconds (>= 2.0) triggers the time-based flush.
+ # An elapsed time beyond the 2000 ms threshold triggers the flush.
Review Comment:
Restored the original comment. All 21 focused tests pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]