Skip to content

Commit

Permalink
Cleanup sqlserver images after tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
dhui committed Apr 16, 2024
1 parent 49cac86 commit b1d02e2
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions database/sqlserver/sqlserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,26 @@ func SkipIfUnsupportedArch(t *testing.T, c dktest.ContainerInfo) {
}

func Test(t *testing.T) {
t.Run("test", test)
t.Run("testMigrate", testMigrate)
t.Run("testMultiStatement", testMultiStatement)
t.Run("testErrorParsing", testErrorParsing)
t.Run("testLockWorks", testLockWorks)
t.Run("testMsiTrue", testMsiTrue)
t.Run("testOpenWithPasswordAndMSI", testOpenWithPasswordAndMSI)
t.Run("testMsiFalse", testMsiFalse)

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) {
SkipIfUnsupportedArch(t, c)
ip, port, err := c.Port(defaultPort)
Expand All @@ -120,7 +140,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) {
SkipIfUnsupportedArch(t, c)
ip, port, err := c.Port(defaultPort)
Expand Down Expand Up @@ -149,7 +169,7 @@ func TestMigrate(t *testing.T) {
})
}

func TestMultiStatement(t *testing.T) {
func testMultiStatement(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
SkipIfUnsupportedArch(t, c)
ip, port, err := c.Port(defaultPort)
Expand Down Expand Up @@ -183,7 +203,7 @@ func TestMultiStatement(t *testing.T) {
})
}

func TestErrorParsing(t *testing.T) {
func testErrorParsing(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
SkipIfUnsupportedArch(t, c)
ip, port, err := c.Port(defaultPort)
Expand Down Expand Up @@ -215,7 +235,7 @@ func TestErrorParsing(t *testing.T) {
})
}

func TestLockWorks(t *testing.T) {
func testLockWorks(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
SkipIfUnsupportedArch(t, c)
ip, port, err := c.Port(defaultPort)
Expand Down Expand Up @@ -254,7 +274,7 @@ func TestLockWorks(t *testing.T) {
})
}

func TestMsiTrue(t *testing.T) {
func testMsiTrue(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
SkipIfUnsupportedArch(t, c)
ip, port, err := c.Port(defaultPort)
Expand All @@ -271,7 +291,7 @@ func TestMsiTrue(t *testing.T) {
})
}

func TestOpenWithPasswordAndMSI(t *testing.T) {
func testOpenWithPasswordAndMSI(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
SkipIfUnsupportedArch(t, c)
ip, port, err := c.Port(defaultPort)
Expand Down Expand Up @@ -303,7 +323,7 @@ func TestOpenWithPasswordAndMSI(t *testing.T) {
})
}

func TestMsiFalse(t *testing.T) {
func testMsiFalse(t *testing.T) {
dktesting.ParallelTest(t, specs, func(t *testing.T, c dktest.ContainerInfo) {
SkipIfUnsupportedArch(t, c)
ip, port, err := c.Port(defaultPort)
Expand Down

0 comments on commit b1d02e2

Please sign in to comment.