@@ -30,6 +30,7 @@ import (
30
30
"go.opentelemetry.io/collector/receiver/receivertest"
31
31
"go.opentelemetry.io/collector/service/internal/servicetelemetry"
32
32
"go.opentelemetry.io/collector/service/internal/status"
33
+ "go.opentelemetry.io/collector/service/internal/status/statustest"
33
34
"go.opentelemetry.io/collector/service/internal/testcomponents"
34
35
"go.opentelemetry.io/collector/service/pipelines"
35
36
)
@@ -154,13 +155,13 @@ func TestGraphStartStop(t *testing.T) {
154
155
pg .componentGraph .SetEdge (simple.Edge {F : f , T : t })
155
156
}
156
157
157
- require .NoError (t , pg .StartAll (ctx , componenttest .NewNopHost ()))
158
+ require .NoError (t , pg .StartAll (ctx , componenttest .NewNopHost (), statustest . NewNopStatusReporter () ))
158
159
for _ , edge := range tt .edges {
159
160
assert .Greater (t , ctx .order [edge [0 ]], ctx .order [edge [1 ]])
160
161
}
161
162
162
163
ctx .order = map [component.ID ]int {}
163
- require .NoError (t , pg .ShutdownAll (ctx ))
164
+ require .NoError (t , pg .ShutdownAll (ctx , statustest . NewNopStatusReporter () ))
164
165
for _ , edge := range tt .edges {
165
166
assert .Less (t , ctx .order [edge [0 ]], ctx .order [edge [1 ]])
166
167
}
@@ -188,11 +189,11 @@ func TestGraphStartStopCycle(t *testing.T) {
188
189
pg .componentGraph .SetEdge (simple.Edge {F : c1 , T : e1 })
189
190
pg .componentGraph .SetEdge (simple.Edge {F : c1 , T : p1 }) // loop back
190
191
191
- err := pg .StartAll (context .Background (), componenttest .NewNopHost ())
192
+ err := pg .StartAll (context .Background (), componenttest .NewNopHost (), statustest . NewNopStatusReporter () )
192
193
assert .Error (t , err )
193
194
assert .Contains (t , err .Error (), `topo: no topological ordering: cyclic components` )
194
195
195
- err = pg .ShutdownAll (context .Background ())
196
+ err = pg .ShutdownAll (context .Background (), statustest . NewNopStatusReporter () )
196
197
assert .Error (t , err )
197
198
assert .Contains (t , err .Error (), `topo: no topological ordering: cyclic components` )
198
199
}
@@ -216,8 +217,8 @@ func TestGraphStartStopComponentError(t *testing.T) {
216
217
F : r1 ,
217
218
T : e1 ,
218
219
})
219
- assert .EqualError (t , pg .StartAll (context .Background (), componenttest .NewNopHost ()), "foo" )
220
- assert .EqualError (t , pg .ShutdownAll (context .Background ()), "bar" )
220
+ assert .EqualError (t , pg .StartAll (context .Background (), componenttest .NewNopHost (), statustest . NewNopStatusReporter () ), "foo" )
221
+ assert .EqualError (t , pg .ShutdownAll (context .Background (), statustest . NewNopStatusReporter () ), "bar" )
221
222
}
222
223
223
224
func TestConnectorPipelinesGraph (t * testing.T ) {
@@ -768,7 +769,7 @@ func TestConnectorPipelinesGraph(t *testing.T) {
768
769
769
770
assert .Equal (t , len (test .pipelineConfigs ), len (pg .pipelines ))
770
771
771
- assert .NoError (t , pg .StartAll (context .Background (), componenttest .NewNopHost ()))
772
+ assert .NoError (t , pg .StartAll (context .Background (), componenttest .NewNopHost (), statustest . NewNopStatusReporter () ))
772
773
773
774
mutatingPipelines := make (map [component.ID ]bool , len (test .pipelineConfigs ))
774
775
@@ -892,7 +893,7 @@ func TestConnectorPipelinesGraph(t *testing.T) {
892
893
}
893
894
894
895
// Shut down the entire component graph
895
- assert .NoError (t , pg .ShutdownAll (context .Background ()))
896
+ assert .NoError (t , pg .ShutdownAll (context .Background (), statustest . NewNopStatusReporter () ))
896
897
897
898
// Check each pipeline individually, ensuring that all components are stopped.
898
899
for pipelineID := range test .pipelineConfigs {
@@ -2148,8 +2149,8 @@ func TestGraphFailToStartAndShutdown(t *testing.T) {
2148
2149
}
2149
2150
pipelines , err := Build (context .Background (), set )
2150
2151
assert .NoError (t , err )
2151
- assert .Error (t , pipelines .StartAll (context .Background (), componenttest .NewNopHost ()))
2152
- assert .Error (t , pipelines .ShutdownAll (context .Background ()))
2152
+ assert .Error (t , pipelines .StartAll (context .Background (), componenttest .NewNopHost (), statustest . NewNopStatusReporter () ))
2153
+ assert .Error (t , pipelines .ShutdownAll (context .Background (), statustest . NewNopStatusReporter () ))
2153
2154
})
2154
2155
2155
2156
t .Run (dt .String ()+ "/processor" , func (t * testing.T ) {
@@ -2162,8 +2163,8 @@ func TestGraphFailToStartAndShutdown(t *testing.T) {
2162
2163
}
2163
2164
pipelines , err := Build (context .Background (), set )
2164
2165
assert .NoError (t , err )
2165
- assert .Error (t , pipelines .StartAll (context .Background (), componenttest .NewNopHost ()))
2166
- assert .Error (t , pipelines .ShutdownAll (context .Background ()))
2166
+ assert .Error (t , pipelines .StartAll (context .Background (), componenttest .NewNopHost (), statustest . NewNopStatusReporter () ))
2167
+ assert .Error (t , pipelines .ShutdownAll (context .Background (), statustest . NewNopStatusReporter () ))
2167
2168
})
2168
2169
2169
2170
t .Run (dt .String ()+ "/exporter" , func (t * testing.T ) {
@@ -2176,8 +2177,8 @@ func TestGraphFailToStartAndShutdown(t *testing.T) {
2176
2177
}
2177
2178
pipelines , err := Build (context .Background (), set )
2178
2179
assert .NoError (t , err )
2179
- assert .Error (t , pipelines .StartAll (context .Background (), componenttest .NewNopHost ()))
2180
- assert .Error (t , pipelines .ShutdownAll (context .Background ()))
2180
+ assert .Error (t , pipelines .StartAll (context .Background (), componenttest .NewNopHost (), statustest . NewNopStatusReporter () ))
2181
+ assert .Error (t , pipelines .ShutdownAll (context .Background (), statustest . NewNopStatusReporter () ))
2181
2182
})
2182
2183
2183
2184
for _ , dt2 := range dataTypes {
@@ -2196,8 +2197,8 @@ func TestGraphFailToStartAndShutdown(t *testing.T) {
2196
2197
}
2197
2198
pipelines , err := Build (context .Background (), set )
2198
2199
assert .NoError (t , err )
2199
- assert .Error (t , pipelines .StartAll (context .Background (), componenttest .NewNopHost ()))
2200
- assert .Error (t , pipelines .ShutdownAll (context .Background ()))
2200
+ assert .Error (t , pipelines .StartAll (context .Background (), componenttest .NewNopHost (), statustest . NewNopStatusReporter () ))
2201
+ assert .Error (t , pipelines .ShutdownAll (context .Background (), statustest . NewNopStatusReporter () ))
2201
2202
})
2202
2203
}
2203
2204
}
@@ -2350,8 +2351,8 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) {
2350
2351
}
2351
2352
pg .componentGraph .SetEdge (simple.Edge {F : e0 , T : e1 })
2352
2353
2353
- assert .Equal (t , tc .startupErr , pg .StartAll (context .Background (), componenttest .NewNopHost ()))
2354
- assert .Equal (t , tc .shutdownErr , pg .ShutdownAll (context .Background ()))
2354
+ assert .Equal (t , tc .startupErr , pg .StartAll (context .Background (), componenttest .NewNopHost (), rep ))
2355
+ assert .Equal (t , tc .shutdownErr , pg .ShutdownAll (context .Background (), rep ))
2355
2356
assertEqualStatuses (t , tc .expectedStatuses , actualStatuses )
2356
2357
})
2357
2358
}
0 commit comments