@@ -294,26 +294,41 @@ func Test_otelAgentGatewayFeature_Configure(t *testing.T) {
294294 Build (),
295295 WantConfigure : true ,
296296 WantDependenciesFunc : testExpectedDepsCreatedCM ,
297- OtelAgentGateway : test .NewDefaultComponentTest ().WithWantFunc (
298- func (t testing.TB , mgrInterface feature.PodTemplateManagers ) {
299- mgr := mgrInterface .(* fake.PodTemplateManagers )
300- podSpec := mgr .PodTemplateSpec ().Spec
297+ OtelAgentGateway : test .NewDefaultComponentTest ().
298+ WithCreateFunc (func (t testing.TB ) (feature.PodTemplateManagers , string ) {
299+ // Create a PodTemplateSpec with otel-agent container
300+ newPTS := corev1.PodTemplateSpec {
301+ Spec : corev1.PodSpec {
302+ Containers : []corev1.Container {
303+ {
304+ Name : string (apicommon .OtelAgent ),
305+ Command : []string {"otelcol" , "--config=/etc/otel/otel-config.yaml" },
306+ },
307+ },
308+ },
309+ }
310+ return fake .NewPodTemplateManagers (t , newPTS ), ""
311+ }).
312+ WithWantFunc (
313+ func (t testing.TB , mgrInterface feature.PodTemplateManagers ) {
314+ mgr := mgrInterface .(* fake.PodTemplateManagers )
315+ podSpec := mgr .PodTemplateSpec ().Spec
301316
302- // Check that featureGates is added to command
303- found := false
304- for _ , container := range podSpec .Containers {
305- if container .Name == string (apicommon .OtelAgent ) {
306- for _ , cmd := range container .Command {
307- if strings .Contains (cmd , "--feature-gates=component.UseLocalHostAsDefaultHost,connector.datadogconnector.NativeIngest" ) {
308- found = true
309- break
317+ // Check that featureGates is added to command
318+ found := false
319+ for _ , container := range podSpec .Containers {
320+ if container .Name == string (apicommon .OtelAgent ) {
321+ for _ , cmd := range container .Command {
322+ if strings .Contains (cmd , "--feature-gates=component.UseLocalHostAsDefaultHost,connector.datadogconnector.NativeIngest" ) {
323+ found = true
324+ break
325+ }
310326 }
311327 }
312328 }
313- }
314- assert .True (t , found , "Expected --feature-gates argument in container command" )
315- },
316- ),
329+ assert .True (t , found , "Expected --feature-gates argument in container command" )
330+ },
331+ ),
317332 },
318333 }
319334 tests .Run (t , buildOtelAgentGatewayFeature )
0 commit comments