@@ -106,14 +106,14 @@ func filterClientDesignators(clients []ClientDesignator) []ClientDesignator {
106
106
DockerfileExt : client .DockerfileExt ,
107
107
BuildArgs : make (map [string ]string ),
108
108
}
109
-
109
+
110
110
// Filter build args
111
111
for key , value := range client .BuildArgs {
112
112
if ! excludedBuildArgs [key ] {
113
113
filteredClient .BuildArgs [key ] = value
114
114
}
115
115
}
116
-
116
+
117
117
filtered [i ] = filteredClient
118
118
}
119
119
return filtered
@@ -123,10 +123,10 @@ func NewTestManager(config SimEnv, b ContainerBackend, clients []*ClientDefiniti
123
123
if hiveInfo .Commit == "" && hiveInfo .Date == "" {
124
124
hiveInfo .Commit , hiveInfo .Date = hiveVersion ()
125
125
}
126
-
126
+
127
127
// Filter sensitive build args from HiveInfo.ClientFile
128
128
hiveInfo .ClientFile = filterClientDesignators (hiveInfo .ClientFile )
129
-
129
+
130
130
return & TestManager {
131
131
clientDefs : clients ,
132
132
config : config ,
@@ -398,29 +398,44 @@ func (manager *TestManager) doEndSuite(testSuite TestSuiteID) error {
398
398
if suite .testDetailsFile != nil {
399
399
suite .testDetailsFile .Close ()
400
400
}
401
-
401
+
402
402
// Create comprehensive run metadata
403
403
runMetadata := & RunMetadata {
404
404
HiveCommand : manager .hiveInfo .Command ,
405
405
HiveVersion : GetHiveVersion (),
406
406
}
407
-
407
+
408
408
// Add client configuration if available
409
409
if manager .hiveInfo .ClientFilePath != "" && len (manager .hiveInfo .ClientFile ) > 0 {
410
410
// Convert existing ClientFile data to consistent format for storage
411
411
clientConfigContent := map [string ]interface {}{
412
412
"clients" : manager .hiveInfo .ClientFile ,
413
413
}
414
-
414
+
415
415
runMetadata .ClientConfig = & ClientConfigInfo {
416
416
FilePath : manager .hiveInfo .ClientFilePath ,
417
417
Content : clientConfigContent ,
418
418
}
419
419
}
420
-
420
+
421
421
// Attach metadata to suite
422
422
suite .RunMetadata = runMetadata
423
-
423
+
424
+ // Clean up any shared clients for this suite.
425
+ if suite .SharedClients != nil {
426
+ for nodeID , clientInfo := range suite .SharedClients {
427
+ // Stop the container if it's still running.
428
+ if clientInfo .wait != nil {
429
+ slog .Info ("cleaning up shared client" , "suite" , testSuite , "client" , clientInfo .Name , "container" , nodeID [:8 ])
430
+ if err := manager .backend .DeleteContainer (clientInfo .ID ); err != nil {
431
+ slog .Error ("could not stop shared client" , "suite" , testSuite , "container" , nodeID [:8 ], "err" , err )
432
+ }
433
+ clientInfo .wait ()
434
+ clientInfo .wait = nil
435
+ }
436
+ }
437
+ }
438
+
424
439
// Write the result.
425
440
if manager .config .LogDir != "" {
426
441
err := writeSuiteFile (suite , manager .config .LogDir )
@@ -565,7 +580,7 @@ func (manager *TestManager) EndTest(suiteID TestSuiteID, testID TestID, result *
565
580
if err == nil {
566
581
defer targetFile .Close ()
567
582
sourceFile .Seek (clientInfo .LogPosition , 0 )
568
- io .CopyN (targetFile , sourceFile , currentPosition - clientInfo .LogPosition )
583
+ io .CopyN (targetFile , sourceFile , currentPosition - clientInfo .LogPosition )
569
584
relativePath := filepath .Join ("shared_clients" ,
570
585
fmt .Sprintf ("%d-%s-test%d.log" , time .Now ().Unix (), nodeID , testID ))
571
586
testCase .ClientInfo [nodeID ].LogFile = relativePath
@@ -790,16 +805,15 @@ func (manager *TestManager) UnpauseNode(testID TestID, nodeID string) error {
790
805
// writeSuiteFile writes the simulation result to the log directory.
791
806
// List of build arguments to exclude from result JSON for security/privacy
792
807
var excludedBuildArgs = map [string ]bool {
793
- "GOPROXY" : true , // Go proxy URLs may contain sensitive info
794
- "GITHUB_TOKEN" : true , // GitHub tokens
795
- "ACCESS_TOKEN" : true , // Generic access tokens
796
- "API_KEY" : true , // API keys
797
- "PASSWORD" : true , // Passwords
798
- "SECRET" : true , // Generic secrets
799
- "TOKEN" : true , // Generic tokens
808
+ "GOPROXY" : true , // Go proxy URLs may contain sensitive info
809
+ "GITHUB_TOKEN" : true , // GitHub tokens
810
+ "ACCESS_TOKEN" : true , // Generic access tokens
811
+ "API_KEY" : true , // API keys
812
+ "PASSWORD" : true , // Passwords
813
+ "SECRET" : true , // Generic secrets
814
+ "TOKEN" : true , // Generic tokens
800
815
}
801
816
802
-
803
817
func writeSuiteFile (s * TestSuite , logdir string ) error {
804
818
suiteData , err := json .Marshal (s )
805
819
if err != nil {
0 commit comments