Skip to content

Commit

Permalink
Cleanup yugabytedb 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 1b707a7 commit 06614d9
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions database/yugabytedb/yugabytedb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ func getConnectionString(ip, port string, options ...string) string {
}

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

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, ci dktest.ContainerInfo) {
createDB(t, ci)

Expand All @@ -109,7 +125,7 @@ func Test(t *testing.T) {
})
}

func TestMigrate(t *testing.T) {
func testMigrate(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, ci dktest.ContainerInfo) {
createDB(t, ci)

Expand All @@ -133,7 +149,7 @@ func TestMigrate(t *testing.T) {
})
}

func TestMultiStatement(t *testing.T) {
func testMultiStatement(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, ci dktest.ContainerInfo) {
createDB(t, ci)

Expand Down Expand Up @@ -163,7 +179,7 @@ func TestMultiStatement(t *testing.T) {
})
}

func TestFilterCustomQuery(t *testing.T) {
func testFilterCustomQuery(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, ci dktest.ContainerInfo) {
createDB(t, ci)

Expand Down

0 comments on commit 06614d9

Please sign in to comment.