Skip to content

Commit bbe66be

Browse files
committed
add failing test
1 parent 31dbb39 commit bbe66be

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_handler.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,27 @@ def test_can_have_multiple_instance_of_same_string_in_extra_data(self, MockWorke
224224
self.assertEqual(log_entry['test2'], 'this is a test string')
225225
self.assertTrue(handler.pipe.empty())
226226

227+
@patch('logtail.handler.FlushWorker')
228+
def test_can_have_multiple_instance_of_same_array_in_extra_data(self, MockWorker):
229+
buffer_capacity = 1
230+
handler = LogtailHandler(
231+
source_token=self.source_token,
232+
buffer_capacity=buffer_capacity
233+
)
234+
235+
logger = logging.getLogger(__name__)
236+
logger.handlers = []
237+
logger.addHandler(handler)
238+
test_array = ['this is a test string']
239+
logger.info('hello', extra={'test1': test_array, 'test2': test_array})
240+
241+
log_entry = handler.pipe.get()
242+
243+
self.assertEqual(log_entry['message'], 'hello')
244+
self.assertEqual(log_entry['test1'], ['this is a test string'])
245+
self.assertEqual(log_entry['test2'], ['this is a test string'])
246+
self.assertTrue(handler.pipe.empty())
247+
227248
@patch('logtail.handler.FlushWorker')
228249
def test_can_send_circular_dependency_in_context(self, MockWorker):
229250
buffer_capacity = 1

0 commit comments

Comments
 (0)