Skip to content

Commit 1b707a7

Browse files
committed
Cleanup cassandra images after tests run
1 parent 2884a8e commit 1b707a7

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

database/cassandra/cassandra_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ func isReady(ctx context.Context, c dktest.ContainerInfo) bool {
6161
}
6262

6363
func Test(t *testing.T) {
64+
t.Run("test", test)
65+
t.Run("testMigrate", testMigrate)
66+
67+
t.Cleanup(func() {
68+
for _, spec := range specs {
69+
t.Log("Cleaning up ", spec.ImageName)
70+
if err := spec.Cleanup(); err != nil {
71+
t.Error("Error removing ", spec.ImageName, "error:", err)
72+
}
73+
}
74+
})
75+
}
76+
77+
func test(t *testing.T) {
6478
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
6579
ip, port, err := c.Port(9042)
6680
if err != nil {
@@ -81,7 +95,7 @@ func Test(t *testing.T) {
8195
})
8296
}
8397

84-
func TestMigrate(t *testing.T) {
98+
func testMigrate(t *testing.T) {
8599
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
86100
ip, port, err := c.Port(9042)
87101
if err != nil {

0 commit comments

Comments
 (0)