File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/collectors/memcached/test Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 55from test import CollectorTestCase
66from test import get_collector_config
77from test import unittest
8+ from mock import MagicMock
89from mock import Mock
910from mock import patch
1011
@@ -27,6 +28,15 @@ def setUp(self):
2728 def test_import (self ):
2829 self .assertTrue (MemcachedCollector )
2930
31+ @patch ('socket.socket' )
32+ def test_get_raw_stats_works_across_packet_boundaries (self , socket_mock ):
33+ socket_instance = MagicMock ()
34+ socket_mock .return_value = socket_instance
35+ stats_packets = ['stat foo 1\r \n ' , 'END\r \n ' ]
36+ socket_instance .recv .side_effect = stats_packets
37+ stats = self .collector .get_raw_stats ('' , None )
38+ self .assertEqual (stats , '' .join (stats_packets ))
39+
3040 @patch .object (Collector , 'publish' )
3141 def test_should_work_with_real_data (self , publish_mock ):
3242 patch_raw_stats = patch .object (
You can’t perform that action at this time.
0 commit comments