Skip to content

Commit 06614d9

Browse files
committed
Cleanup yugabytedb images after tests run
1 parent 1b707a7 commit 06614d9

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

database/yugabytedb/yugabytedb_test.go

+19-3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,22 @@ func getConnectionString(ip, port string, options ...string) string {
9191
}
9292

9393
func Test(t *testing.T) {
94+
t.Run("test", test)
95+
t.Run("testMigrate", testMigrate)
96+
t.Run("testMultiStatement", testMultiStatement)
97+
t.Run("testFilterCustomQuery", testFilterCustomQuery)
98+
99+
t.Cleanup(func() {
100+
for _, spec := range specs {
101+
t.Log("Cleaning up ", spec.ImageName)
102+
if err := spec.Cleanup(); err != nil {
103+
t.Error("Error removing ", spec.ImageName, "error:", err)
104+
}
105+
}
106+
})
107+
}
108+
109+
func test(t *testing.T) {
94110
dktesting.ParallelTest(t, specs, func(t *testing.T, ci dktest.ContainerInfo) {
95111
createDB(t, ci)
96112

@@ -109,7 +125,7 @@ func Test(t *testing.T) {
109125
})
110126
}
111127

112-
func TestMigrate(t *testing.T) {
128+
func testMigrate(t *testing.T) {
113129
dktesting.ParallelTest(t, specs, func(t *testing.T, ci dktest.ContainerInfo) {
114130
createDB(t, ci)
115131

@@ -133,7 +149,7 @@ func TestMigrate(t *testing.T) {
133149
})
134150
}
135151

136-
func TestMultiStatement(t *testing.T) {
152+
func testMultiStatement(t *testing.T) {
137153
dktesting.ParallelTest(t, specs, func(t *testing.T, ci dktest.ContainerInfo) {
138154
createDB(t, ci)
139155

@@ -163,7 +179,7 @@ func TestMultiStatement(t *testing.T) {
163179
})
164180
}
165181

166-
func TestFilterCustomQuery(t *testing.T) {
182+
func testFilterCustomQuery(t *testing.T) {
167183
dktesting.ParallelTest(t, specs, func(t *testing.T, ci dktest.ContainerInfo) {
168184
createDB(t, ci)
169185

0 commit comments

Comments
 (0)