Skip to content

Commit 152e720

Browse files
committed
Address review comments
Signed-off-by: Pablo Chacin <[email protected]>
1 parent cd568f1 commit 152e720

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

modules/k6/k6.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import (
99
"github.com/docker/docker/api/types/mount"
1010

1111
"github.com/testcontainers/testcontainers-go"
12-
"github.com/testcontainers/testcontainers-go/internal/testcontainersdocker"
13-
"github.com/testcontainers/testcontainers-go/internal/testcontainerssession"
1412
"github.com/testcontainers/testcontainers-go/wait"
1513
)
1614

@@ -55,18 +53,18 @@ func SetEnvVar(variable string, value string) testcontainers.CustomizeRequestOpt
5553
}
5654

5755
// WithCache sets a volume as a cache for building the k6 binary
58-
// If a volume name is provided in the TC_K6_BUILD_CACHE, this volume is used.
59-
// If no value is provided, a volume is created and removed when the test session ends.
56+
// If a volume name is provided in the TC_K6_BUILD_CACHE, this volume is used and it will
57+
// persist across test sessions.
58+
// If no value is provided, a volume is created and automatically deleted when the test session ends.
6059
func WithCache() testcontainers.CustomizeRequestOption {
6160
var volOptions *mount.VolumeOptions
6261

6362
cacheVol := os.Getenv("TC_K6_BUILD_CACHE")
6463
// if no volume is provided, create one and ensure add labels for garbage collection
6564
if cacheVol == "" {
66-
sessionID := testcontainerssession.SessionID()
67-
cacheVol = fmt.Sprintf("k6-cache-%s", sessionID)
65+
cacheVol = fmt.Sprintf("k6-cache-%s", testcontainers.SessionID())
6866
volOptions = &mount.VolumeOptions{
69-
Labels: testcontainersdocker.DefaultLabels(sessionID),
67+
Labels: testcontainers.GenericLabels(),
7068
}
7169
}
7270

0 commit comments

Comments
 (0)