@@ -44,6 +44,7 @@ def test_storage_type_and_operation_mode(self, mocker):
4444 def test_method_latencies (self , mocker ):
4545 method_latencies = MethodLatencies ()
4646
47+ method_latencies .pop_all () # should not raise exception
4748 for method in ModelTelemetry .MethodExceptionsAndLatencies :
4849 method_latencies .add_latency (method , 50 )
4950 if method .value == 'treatment' :
@@ -116,6 +117,7 @@ def test_method_latencies(self, mocker):
116117 def test_http_latencies (self , mocker ):
117118 http_latencies = HTTPLatencies ()
118119
120+ http_latencies .pop_all () # should not raise exception
119121 for resource in ModelTelemetry .HTTPExceptionsAndLatencies :
120122 if self ._get_http_latency (resource , http_latencies ) == None :
121123 continue
@@ -169,6 +171,7 @@ def _get_http_latency(self, resource, storage):
169171 def test_method_exceptions (self , mocker ):
170172 method_exception = MethodExceptions ()
171173
174+ exceptions = method_exception .pop_all () # should not raise exception
172175 [method_exception .add_exception (ModelTelemetry .MethodExceptionsAndLatencies .TREATMENT ) for i in range (2 )]
173176 method_exception .add_exception (ModelTelemetry .MethodExceptionsAndLatencies .TREATMENTS )
174177 method_exception .add_exception (ModelTelemetry .MethodExceptionsAndLatencies .TREATMENT_WITH_CONFIG )
@@ -200,6 +203,7 @@ def test_method_exceptions(self, mocker):
200203
201204 def test_http_errors (self , mocker ):
202205 http_error = HTTPErrors ()
206+ errors = http_error .pop_all () # should not raise exception
203207 [http_error .add_error (ModelTelemetry .HTTPExceptionsAndLatencies .SEGMENT , str (i )) for i in [500 , 501 , 502 ]]
204208 [http_error .add_error (ModelTelemetry .HTTPExceptionsAndLatencies .SPLIT , str (i )) for i in [400 , 401 , 402 ]]
205209 http_error .add_error (ModelTelemetry .HTTPExceptionsAndLatencies .IMPRESSION , '502' )
@@ -220,6 +224,7 @@ def test_http_errors(self, mocker):
220224
221225 def test_last_synchronization (self , mocker ):
222226 last_synchronization = LastSynchronization ()
227+ last_synchronization .get_all () # should not raise exception
223228 last_synchronization .add_latency (ModelTelemetry .HTTPExceptionsAndLatencies .SPLIT , 10 )
224229 last_synchronization .add_latency (ModelTelemetry .HTTPExceptionsAndLatencies .IMPRESSION , 20 )
225230 last_synchronization .add_latency (ModelTelemetry .HTTPExceptionsAndLatencies .SEGMENT , 40 )
@@ -240,19 +245,27 @@ def test_telemetry_counters(self):
240245 assert (telemetry_counter ._token_refreshes == 0 )
241246 assert (telemetry_counter ._update_from_sse == {})
242247
248+ assert (telemetry_counter .get_session_length () == 0 )
243249 telemetry_counter .record_session_length (20 )
244250 assert (telemetry_counter .get_session_length () == 20 )
245251
252+ assert (telemetry_counter .pop_auth_rejections () == 0 )
246253 [telemetry_counter .record_auth_rejections () for i in range (5 )]
247254 auth_rejections = telemetry_counter .pop_auth_rejections ()
248255 assert (telemetry_counter ._auth_rejections == 0 )
249256 assert (auth_rejections == 5 )
250257
258+ assert (telemetry_counter .pop_token_refreshes () == 0 )
251259 [telemetry_counter .record_token_refreshes () for i in range (3 )]
252260 token_refreshes = telemetry_counter .pop_token_refreshes ()
253261 assert (telemetry_counter ._token_refreshes == 0 )
254262 assert (token_refreshes == 3 )
255263
264+ assert (telemetry_counter .get_counter_stats (ModelTelemetry .CounterConstants .IMPRESSIONS_QUEUED ) == 0 )
265+ assert (telemetry_counter .get_counter_stats (ModelTelemetry .CounterConstants .IMPRESSIONS_DEDUPED ) == 0 )
266+ assert (telemetry_counter .get_counter_stats (ModelTelemetry .CounterConstants .IMPRESSIONS_DROPPED ) == 0 )
267+ assert (telemetry_counter .get_counter_stats (ModelTelemetry .CounterConstants .EVENTS_QUEUED ) == 0 )
268+ assert (telemetry_counter .get_counter_stats (ModelTelemetry .CounterConstants .EVENTS_DROPPED ) == 0 )
256269 telemetry_counter .record_impressions_value (ModelTelemetry .CounterConstants .IMPRESSIONS_QUEUED , 10 )
257270 assert (telemetry_counter ._impressions_queued == 10 )
258271 telemetry_counter .record_impressions_value (ModelTelemetry .CounterConstants .IMPRESSIONS_DEDUPED , 14 )
@@ -263,6 +276,7 @@ def test_telemetry_counters(self):
263276 assert (telemetry_counter ._events_queued == 30 )
264277 telemetry_counter .record_events_value (ModelTelemetry .CounterConstants .EVENTS_DROPPED , 1 )
265278 assert (telemetry_counter ._events_dropped == 1 )
279+ assert (telemetry_counter .pop_update_from_sse (UpdateFromSSE .SPLIT_UPDATE ) == 0 )
266280 telemetry_counter .record_update_from_sse (UpdateFromSSE .SPLIT_UPDATE )
267281 assert (telemetry_counter ._update_from_sse [UpdateFromSSE .SPLIT_UPDATE .value ] == 1 )
268282 updates = telemetry_counter .pop_update_from_sse (UpdateFromSSE .SPLIT_UPDATE )
@@ -277,6 +291,7 @@ def test_streaming_event(self, mocker):
277291
278292 def test_streaming_events (self , mocker ):
279293 streaming_events = StreamingEvents ()
294+ events = streaming_events .pop_streaming_events () # should not raise exception
280295 streaming_events .record_streaming_event ((ModelTelemetry .StreamingEventTypes .CONNECTION_ESTABLISHED , 'split' , 1234 ))
281296 streaming_events .record_streaming_event ((ModelTelemetry .StreamingEventTypes .STREAMING_STATUS , 'split' , 1234 ))
282297 events = streaming_events .pop_streaming_events ()
@@ -286,6 +301,7 @@ def test_streaming_events(self, mocker):
286301
287302 def test_telemetry_config (self ):
288303 telemetry_config = TelemetryConfig ()
304+ stats = telemetry_config .get_stats () # should not raise exception
289305 config = {'operationMode' : 'standalone' ,
290306 'streamingEnabled' : True ,
291307 'impressionsQueueSize' : 100 ,
@@ -326,9 +342,11 @@ def test_telemetry_config(self):
326342 telemetry_config .record_flag_sets (5 )
327343 assert (telemetry_config ._flag_sets == 5 )
328344
345+ assert (telemetry_config .get_bur_time_outs () == 0 )
329346 [telemetry_config .record_bur_time_out () for i in range (2 )]
330347 assert (telemetry_config .get_bur_time_outs () == 2 )
331348
349+ assert (telemetry_config .get_non_ready_usage () == 0 )
332350 [telemetry_config .record_not_ready_usage () for i in range (5 )]
333351 assert (telemetry_config .get_non_ready_usage () == 5 )
334352
0 commit comments