@@ -34,7 +34,6 @@ import (
34
34
conventions "go.opentelemetry.io/collector/semconv/v1.27.0"
35
35
36
36
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil"
37
- "github.com/open-telemetry/opentelemetry-collector-contrib/internal/splunk"
38
37
)
39
38
40
39
func expectedTraceData (t1 , t2 , t3 time.Time ) ptrace.Traces {
@@ -336,7 +335,6 @@ func TestReception(t *testing.T) {
336
335
}
337
336
for _ , tt := range tests {
338
337
t .Run (tt .name , func (t * testing.T ) {
339
-
340
338
sink := new (consumertest.TracesSink )
341
339
sr := setupReceiver (t , tt .args .config , sink )
342
340
defer func () {
@@ -362,78 +360,6 @@ func TestReception(t *testing.T) {
362
360
}
363
361
}
364
362
365
- func TestAccessTokenPassthrough (t * testing.T ) {
366
- tests := []struct {
367
- name string
368
- accessTokenPassthrough bool
369
- token string
370
- }{
371
- {
372
- name : "no passthrough and no token" ,
373
- accessTokenPassthrough : false ,
374
- token : "" ,
375
- },
376
- {
377
- name : "no passthrough and token" ,
378
- accessTokenPassthrough : false ,
379
- token : "MyAccessToken" ,
380
- },
381
- {
382
- name : "passthrough and no token" ,
383
- accessTokenPassthrough : true ,
384
- token : "" ,
385
- },
386
- {
387
- name : "passthrough and token" ,
388
- accessTokenPassthrough : true ,
389
- token : "MyAccessToken" ,
390
- },
391
- }
392
- for _ , tt := range tests {
393
- t .Run (tt .name , func (t * testing.T ) {
394
- config := & Config {
395
- ServerConfig : confighttp.ServerConfig {
396
- Endpoint : "0.0.0.0:7226" ,
397
- },
398
- AccessTokenPassthroughConfig : splunk.AccessTokenPassthroughConfig {
399
- AccessTokenPassthrough : tt .accessTokenPassthrough ,
400
- },
401
- }
402
-
403
- sapm := & splunksapm.PostSpansRequest {
404
- Batches : []* model.Batch {grpcFixture (time .Now ().UTC ())},
405
- }
406
-
407
- sink := new (consumertest.TracesSink )
408
- sr := setupReceiver (t , config , sink )
409
- defer func () {
410
- require .NoError (t , sr .Shutdown (context .Background ()))
411
- }()
412
-
413
- var resp * http.Response
414
- resp , err := sendSapm (config .Endpoint , sapm , "gzip" , false , tt .token )
415
- require .NoErrorf (t , err , "should not have failed when sending sapm %v" , err )
416
- assert .Equal (t , 200 , resp .StatusCode )
417
- assert .NoError (t , resp .Body .Close ())
418
-
419
- got := sink .AllTraces ()
420
- assert .Len (t , got , 1 )
421
-
422
- received := got [0 ].ResourceSpans ()
423
- for i := 0 ; i < received .Len (); i ++ {
424
- rspan := received .At (i )
425
- attrs := rspan .Resource ().Attributes ()
426
- amap , contains := attrs .Get ("com.splunk.signalfx.access_token" )
427
- if tt .accessTokenPassthrough && tt .token != "" {
428
- assert .Equal (t , tt .token , amap .Str ())
429
- } else {
430
- assert .False (t , contains )
431
- }
432
- }
433
- })
434
- }
435
- }
436
-
437
363
func TestStatusCode (t * testing.T ) {
438
364
tlsAddress := testutil .GetAvailableLocalAddress (t )
439
365
0 commit comments