File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "COUNTERS_EVENTS:latency_in_ms" : {
3
+ "value" : 2
4
+ },
5
+ "COUNTERS_EVENTS:missed_to_cache" : {
6
+ "value" : 0
7
+ },
8
+ "COUNTERS_EVENTS:missed_internal" : {
9
+ "value" : 0
10
+ },
11
+ "COUNTERS_EVENTS:missed_by_slow_receiver" : {
12
+ "value" : 0
13
+ },
14
+ "COUNTERS_EVENTS:published" : {
15
+ "value" : 40147
16
+ }
17
+ }
18
+
Original file line number Diff line number Diff line change
1
+ import os
2
+ import sys
3
+ from click .testing import CliRunner
4
+ from utilities_common .db import Db
5
+ import show .main as show
6
+
7
+ class TestShowEventCounters (object ):
8
+ @classmethod
9
+ def setup_class (cls ):
10
+ print ("SETUP" )
11
+ os .environ ["UTILITIES_UNIT_TESTING" ] = "1"
12
+
13
+ def test_event_counters_show (self ):
14
+ from .mock_tables import dbconnector
15
+ test_path = os .path .dirname (os .path .abspath (__file__ ))
16
+ mock_db_path = os .path .join (test_path , "event_counters_input" )
17
+ jsonfile_counters = os .path .join (mock_db_path , "counters_db" )
18
+ dbconnector .dedicated_dbs ['COUNTERS_DB' ] = jsonfile_counters
19
+ runner = CliRunner ()
20
+ db = Db ()
21
+ expected_output = """\
22
+ name count
23
+ ----------------------- -------
24
+ latency_in_ms 2
25
+ missed_by_slow_receiver 0
26
+ missed_internal 0
27
+ missed_to_cache 0
28
+ published 40147
29
+ """
30
+
31
+ result = runner .invoke (show .cli .commands ['event-counters' ], [], obj = db )
32
+ print (result .exit_code )
33
+ print (result .output )
34
+ dbconnector .dedicated_dbs ['COUNTERS_DB' ] = None
35
+ assert result .exit_code == 0
36
+ assert result .output == expected_output
37
+
You can’t perform that action at this time.
0 commit comments