Skip to content

Commit

Permalink
add check_interval to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrHeinz committed Jun 19, 2024
1 parent 87c340e commit fa56374
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/test_flusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ class TestFlushWorker(unittest.TestCase):
source_token = 'dummy_source_token'
buffer_capacity = 5
flush_interval = 2
check_interval = 0.01

def _setup_worker(self, uploader=None):
pipe = queue.Queue(maxsize=self.buffer_capacity)
uploader = uploader or Uploader(self.source_token, self.host)
fw = FlushWorker(uploader, pipe, self.buffer_capacity, self.flush_interval)
fw = FlushWorker(uploader, pipe, self.buffer_capacity, self.flush_interval, self.check_interval)
return pipe, uploader, fw

def test_is_thread(self):
Expand Down
6 changes: 4 additions & 2 deletions tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def test_handler_creates_pipe_from_args(self, MockWorker):
def test_handler_creates_and_starts_worker_from_args_after_first_log(self, MockWorker):
buffer_capacity = 9
flush_interval = 9
handler = LogtailHandler(source_token=self.source_token, buffer_capacity=buffer_capacity, flush_interval=flush_interval)
check_interval = 4
handler = LogtailHandler(source_token=self.source_token, buffer_capacity=buffer_capacity, flush_interval=flush_interval, check_interval=check_interval)

self.assertFalse(MockWorker.called)

Expand All @@ -47,7 +48,8 @@ def test_handler_creates_and_starts_worker_from_args_after_first_log(self, MockW
handler.uploader,
handler.pipe,
buffer_capacity,
flush_interval
flush_interval,
check_interval,
)
self.assertEqual(handler.flush_thread.start.call_count, 1)

Expand Down

0 comments on commit fa56374

Please sign in to comment.