File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,8 @@ func TestQueueEventDispatcher_DispatchEvent(t *testing.T) {
104104 metricsRegistry := NewMetricsRegistry ()
105105
106106 q := NewQueueEventDispatcher (metricsRegistry )
107- q .Dispatcher = & MockDispatcher {Events : NewInMemoryQueue (100 )}
107+ sender := & MockDispatcher {Events : NewInMemoryQueue (100 )}
108+ q .Dispatcher = sender
108109
109110 eventTags := map [string ]interface {}{"revenue" : 55.0 , "value" : 25.1 }
110111 config := TestConfig {}
@@ -120,13 +121,14 @@ func TestQueueEventDispatcher_DispatchEvent(t *testing.T) {
120121 assert .True (t , success )
121122
122123 // its been queued
123- assert .Equal (t , 1 , q .eventQueue .Size ())
124+ assert .True (t , ( q . eventQueue . Size () == 1 && sender . Events . Size () == 0 ) || ( q .eventQueue .Size () == 0 && sender . Events . Size () == 1 ))
124125
125126 // give the queue a chance to run
126127 time .Sleep (1 * time .Second )
127128
128129 // check the queue
129130 assert .Equal (t , 0 , q .eventQueue .Size ())
131+ assert .Equal (t , 1 , sender .Events .Size ())
130132
131133 assert .Equal (t , float64 (0 ), metricsRegistry .GetGauge (metrics .DispatcherQueueSize ).(* MetricsGauge ).Get ())
132134 assert .Equal (t , float64 (1 ), metricsRegistry .GetCounter (metrics .DispatcherSuccessFlush ).(* MetricsCounter ).Get ())
You can’t perform that action at this time.
0 commit comments