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) {
104
104
metricsRegistry := NewMetricsRegistry ()
105
105
106
106
q := NewQueueEventDispatcher (metricsRegistry )
107
- q .Dispatcher = & MockDispatcher {Events : NewInMemoryQueue (100 )}
107
+ sender := & MockDispatcher {Events : NewInMemoryQueue (100 )}
108
+ q .Dispatcher = sender
108
109
109
110
eventTags := map [string ]interface {}{"revenue" : 55.0 , "value" : 25.1 }
110
111
config := TestConfig {}
@@ -120,13 +121,14 @@ func TestQueueEventDispatcher_DispatchEvent(t *testing.T) {
120
121
assert .True (t , success )
121
122
122
123
// 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 ))
124
125
125
126
// give the queue a chance to run
126
127
time .Sleep (1 * time .Second )
127
128
128
129
// check the queue
129
130
assert .Equal (t , 0 , q .eventQueue .Size ())
131
+ assert .Equal (t , 1 , sender .Events .Size ())
130
132
131
133
assert .Equal (t , float64 (0 ), metricsRegistry .GetGauge (metrics .DispatcherQueueSize ).(* MetricsGauge ).Get ())
132
134
assert .Equal (t , float64 (1 ), metricsRegistry .GetCounter (metrics .DispatcherSuccessFlush ).(* MetricsCounter ).Get ())
You can’t perform that action at this time.
0 commit comments