@@ -348,7 +348,11 @@ func TestOTelManager_Run(t *testing.T) {
348348 {
349349 name : "subprocess collector config updates" ,
350350 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
351- return newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
351+ hcUUID , err := uuid .NewV4 ()
352+ if err != nil {
353+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
354+ }
355+ return newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
352356 },
353357 restarter : newRecoveryBackoff (100 * time .Nanosecond , 10 * time .Second , time .Minute ),
354358 testFn : func (t * testing.T , m * OTelManager , e * EventListener , exec * testExecution , managerCtxCancel context.CancelFunc , collectorRunErr chan error ) {
@@ -376,7 +380,11 @@ func TestOTelManager_Run(t *testing.T) {
376380 {
377381 name : "subprocess collector stopped gracefully outside manager" ,
378382 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
379- return newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
383+ hcUUID , err := uuid .NewV4 ()
384+ if err != nil {
385+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
386+ }
387+ return newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
380388 },
381389 restarter : newRecoveryBackoff (100 * time .Nanosecond , 10 * time .Second , time .Minute ),
382390 testFn : func (t * testing.T , m * OTelManager , e * EventListener , exec * testExecution , managerCtxCancel context.CancelFunc , collectorRunErr chan error ) {
@@ -405,7 +413,11 @@ func TestOTelManager_Run(t *testing.T) {
405413 {
406414 name : "subprocess collector killed outside manager" ,
407415 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
408- return newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
416+ hcUUID , err := uuid .NewV4 ()
417+ if err != nil {
418+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
419+ }
420+ return newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
409421 },
410422 restarter : newRecoveryBackoff (100 * time .Nanosecond , 10 * time .Second , time .Minute ),
411423 testFn : func (t * testing.T , m * OTelManager , e * EventListener , exec * testExecution , managerCtxCancel context.CancelFunc , collectorRunErr chan error ) {
@@ -448,7 +460,11 @@ func TestOTelManager_Run(t *testing.T) {
448460 {
449461 name : "subprocess collector panics restarts" ,
450462 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
451- return newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
463+ hcUUID , err := uuid .NewV4 ()
464+ if err != nil {
465+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
466+ }
467+ return newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
452468 },
453469 restarter : newRecoveryBackoff (100 * time .Nanosecond , 10 * time .Second , time .Minute ),
454470 testFn : func (t * testing.T , m * OTelManager , e * EventListener , exec * testExecution , managerCtxCancel context.CancelFunc , collectorRunErr chan error ) {
@@ -483,7 +499,11 @@ func TestOTelManager_Run(t *testing.T) {
483499 {
484500 name : "subprocess collector panics reports fatal" ,
485501 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
486- return newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
502+ hcUUID , err := uuid .NewV4 ()
503+ if err != nil {
504+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
505+ }
506+ return newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
487507 },
488508 restarter : newRecoveryBackoff (100 * time .Nanosecond , 10 * time .Second , time .Minute ),
489509 testFn : func (t * testing.T , m * OTelManager , e * EventListener , exec * testExecution , managerCtxCancel context.CancelFunc , collectorRunErr chan error ) {
@@ -524,7 +544,11 @@ func TestOTelManager_Run(t *testing.T) {
524544 {
525545 name : "subprocess collector killed if delayed and manager is stopped" ,
526546 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
527- subprocessExec , err := newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
547+ hcUUID , err := uuid .NewV4 ()
548+ if err != nil {
549+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
550+ }
551+ subprocessExec , err := newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
528552 if err != nil {
529553 return nil , err
530554 }
@@ -577,7 +601,11 @@ func TestOTelManager_Run(t *testing.T) {
577601 {
578602 name : "subprocess collector gracefully exited if delayed a bit and manager is stopped" ,
579603 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
580- subprocessExec , err := newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
604+ hcUUID , err := uuid .NewV4 ()
605+ if err != nil {
606+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
607+ }
608+ subprocessExec , err := newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
581609 if err != nil {
582610 return nil , err
583611 }
@@ -630,7 +658,11 @@ func TestOTelManager_Run(t *testing.T) {
630658 {
631659 name : "subprocess user has healthcheck extension" ,
632660 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
633- return newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
661+ hcUUID , err := uuid .NewV4 ()
662+ if err != nil {
663+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
664+ }
665+ return newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
634666 },
635667 restarter : newRecoveryBackoff (100 * time .Nanosecond , 10 * time .Second , time .Minute ),
636668 testFn : func (t * testing.T , m * OTelManager , e * EventListener , exec * testExecution , managerCtxCancel context.CancelFunc , collectorRunErr chan error ) {
@@ -665,7 +697,11 @@ func TestOTelManager_Run(t *testing.T) {
665697 {
666698 name : "subprocess collector empty config" ,
667699 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
668- return newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
700+ hcUUID , err := uuid .NewV4 ()
701+ if err != nil {
702+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
703+ }
704+ return newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
669705 },
670706 restarter : newRecoveryBackoff (100 * time .Nanosecond , 10 * time .Second , time .Minute ),
671707 skipListeningErrors : true ,
@@ -712,7 +748,11 @@ func TestOTelManager_Run(t *testing.T) {
712748 {
713749 name : "subprocess collector failed to start" ,
714750 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
715- return newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
751+ hcUUID , err := uuid .NewV4 ()
752+ if err != nil {
753+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
754+ }
755+ return newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
716756 },
717757 restarter : newRecoveryBackoff (100 * time .Nanosecond , 10 * time .Second , time .Minute ),
718758 testFn : func (t * testing.T , m * OTelManager , e * EventListener , exec * testExecution , managerCtxCancel context.CancelFunc , collectorRunErr chan error ) {
@@ -846,7 +886,11 @@ func TestOTelManager_Logging(t *testing.T) {
846886 {
847887 name : "subprocess execution" ,
848888 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
849- return newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
889+ hcUUID , err := uuid .NewV4 ()
890+ if err != nil {
891+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
892+ }
893+ return newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), 0 , 0 )
850894 },
851895 },
852896 } {
@@ -919,7 +963,11 @@ func TestOTelManager_Ports(t *testing.T) {
919963 {
920964 name : "subprocess execution" ,
921965 execModeFn : func (collectorRunErr chan error ) (collectorExecution , error ) {
922- return newSubprocessExecution (logp .DebugLevel , testBinary , metricsPort , healthCheckPort )
966+ hcUUID , err := uuid .NewV4 ()
967+ if err != nil {
968+ return nil , fmt .Errorf ("cannot generate UUID: %w" , err )
969+ }
970+ return newSubprocessExecution (logp .DebugLevel , testBinary , hcUUID .String (), metricsPort , healthCheckPort )
923971 },
924972 healthCheckEnabled : true ,
925973 },
@@ -1071,7 +1119,7 @@ func TestOTelManager_PortConflict(t *testing.T) {
10711119 waitTimeForStop ,
10721120 )
10731121 require .NoError (t , err , "could not create otel manager" )
1074- executionMode , err := newSubprocessExecution (logp .DebugLevel , testBinary , 0 , 0 )
1122+ executionMode , err := newSubprocessExecution (logp .DebugLevel , testBinary , strings . TrimPrefix ( m . healthCheckExtID , "extension:healthcheckv2/" ), 0 , 0 )
10751123 require .NoError (t , err , "could not create subprocess execution mode" )
10761124 m .execution = executionMode
10771125
@@ -1288,6 +1336,9 @@ func TestOTelManager_handleOtelStatusUpdate(t *testing.T) {
12881336 "extension:elastic_diagnostics/test" : {
12891337 Event : componentstatus .NewEvent (componentstatus .StatusOK ),
12901338 },
1339+ "extension:healthcheckv2/uuid" : {
1340+ Event : componentstatus .NewEvent (componentstatus .StatusOK ),
1341+ },
12911342 },
12921343 },
12931344 },
@@ -1373,6 +1424,7 @@ func TestOTelManager_handleOtelStatusUpdate(t *testing.T) {
13731424 mgr := & OTelManager {
13741425 logger : newTestLogger (),
13751426 components : tt .components ,
1427+ healthCheckExtID : "extension:healthcheckv2/uuid" ,
13761428 currentComponentStates : make (map [string ]runtime.ComponentComponentState ),
13771429 }
13781430
0 commit comments