Skip to content

Commit c8e2e13

Browse files
authored
Fix: s3 block tests out of space (#9848)
* Fix: s3 block tests out of space * CR Fixes
1 parent f8c765f commit c8e2e13

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pkg/block/s3/main_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ func newClient(port string) (*minio.Client, error) {
3333
// TestMain spins up a MinIO Container and add a bucket for use in package tests
3434
func TestMain(m *testing.M) {
3535
var err error
36+
tmpDir, err := os.MkdirTemp("", "minio-data-*") // map tmp path to volume to reduce change of failure due to out of capacity
37+
if err != nil {
38+
panic(err)
39+
}
3640
pool, err = dockertest.NewPool("")
3741
if err != nil {
3842
log.Fatalf("Could not connect to Docker: %s", err)
@@ -44,9 +48,9 @@ func TestMain(m *testing.M) {
4448
fmt.Sprintf("MINIO_ROOT_USER=%s", minioTestAccessKeyID),
4549
fmt.Sprintf("MINIO_ROOT_PASSWORD=%s", minioTestSecretAccessKey),
4650
},
47-
Cmd: []string{
48-
"server",
49-
"start",
51+
Cmd: []string{"server", "/data"},
52+
Mounts: []string{
53+
fmt.Sprintf("%s:/data", tmpDir),
5054
},
5155
})
5256
if err != nil {
@@ -55,7 +59,8 @@ func TestMain(m *testing.M) {
5559

5660
// set cleanup
5761
closer := func() {
58-
err := pool.Purge(resource)
62+
err = pool.Purge(resource)
63+
_ = os.RemoveAll(tmpDir)
5964
if err != nil {
6065
panic("could not purge minio container: " + err.Error())
6166
}

0 commit comments

Comments
 (0)