File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -121,3 +121,36 @@ func TestUpdatePrometheusCounters(t *testing.T) {
121
121
tracer .updatePrometheusCounters (MCP .String ())
122
122
assert .Equal (t , 8 , counter )
123
123
}
124
+
125
+ func TestGetStrategy (t * testing.T ) {
126
+ mockStrategy := func (event Event ) {}
127
+
128
+ tracer := GetInstance (mockStrategy )
129
+
130
+ retrievedStrategy := tracer .GetStrategy ()
131
+ assert .NotNil (t , retrievedStrategy )
132
+ }
133
+
134
+ func TestSetGetStrategyConcurrency (t * testing.T ) {
135
+ tracer := GetInstance (func (event Event ) {})
136
+
137
+ var wg sync.WaitGroup
138
+
139
+ for i := 0 ; i < 10 ; i ++ {
140
+ wg .Add (2 )
141
+
142
+ go func (id int ) {
143
+ defer wg .Done ()
144
+ mockStrategy := func (event Event ) {}
145
+ tracer .SetStrategy (mockStrategy )
146
+ }(i )
147
+
148
+ go func (id int ) {
149
+ defer wg .Done ()
150
+ strategy := tracer .GetStrategy ()
151
+ assert .NotNil (t , strategy )
152
+ }(i )
153
+ }
154
+
155
+ wg .Wait ()
156
+ }
You can’t perform that action at this time.
0 commit comments