purge minio test container at the end of tests
Also, add container option to auto-remove a container when stopped, in case a container is left behind due to some reason. Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
parent
c74180503c
commit
3a17461777
|
@ -29,6 +29,7 @@ import (
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
miniov7 "github.com/minio/minio-go/v7"
|
miniov7 "github.com/minio/minio-go/v7"
|
||||||
"github.com/ory/dockertest/v3"
|
"github.com/ory/dockertest/v3"
|
||||||
|
"github.com/ory/dockertest/v3/docker"
|
||||||
"gotest.tools/assert"
|
"gotest.tools/assert"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
@ -125,6 +126,8 @@ func TestMain(m *testing.M) {
|
||||||
"MINIO_ROOT_PASSWORD=" + testMinioRootPassword,
|
"MINIO_ROOT_PASSWORD=" + testMinioRootPassword,
|
||||||
},
|
},
|
||||||
Cmd: []string{"server", "/data", "--console-address", ":9001"},
|
Cmd: []string{"server", "/data", "--console-address", ":9001"},
|
||||||
|
}, func(config *docker.HostConfig) {
|
||||||
|
config.AutoRemove = true
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("could not start resource: %s", err)
|
log.Fatalf("could not start resource: %s", err)
|
||||||
|
@ -168,6 +171,7 @@ func TestMain(m *testing.M) {
|
||||||
run := m.Run()
|
run := m.Run()
|
||||||
removeObjectFromBucket(ctx)
|
removeObjectFromBucket(ctx)
|
||||||
deleteBucket(ctx)
|
deleteBucket(ctx)
|
||||||
|
purgeResource()
|
||||||
os.Exit(run)
|
os.Exit(run)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue