File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff 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
3434func 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 }
You can’t perform that action at this time.
0 commit comments