Skip to content

Commit

Permalink
Cleanup cassandra images after tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
dhui committed Apr 15, 2024
1 parent 2884a8e commit 1b707a7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion database/cassandra/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ func isReady(ctx context.Context, c dktest.ContainerInfo) bool {
}

func Test(t *testing.T) {
t.Run("test", test)
t.Run("testMigrate", testMigrate)

t.Cleanup(func() {
for _, spec := range specs {
t.Log("Cleaning up ", spec.ImageName)
if err := spec.Cleanup(); err != nil {
t.Error("Error removing ", spec.ImageName, "error:", err)
}
}
})
}

func test(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
ip, port, err := c.Port(9042)
if err != nil {
Expand All @@ -81,7 +95,7 @@ func Test(t *testing.T) {
})
}

func TestMigrate(t *testing.T) {
func testMigrate(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
ip, port, err := c.Port(9042)
if err != nil {
Expand Down

0 comments on commit 1b707a7

Please sign in to comment.