@@ -74,6 +74,22 @@ func isReady(ctx context.Context, c dktest.ContainerInfo) bool {
7474}
7575
7676func Test (t * testing.T ) {
77+ t .Run ("test" , test )
78+ t .Run ("testMigrate" , testMigrate )
79+ t .Run ("testWithAuth" , testWithAuth )
80+ t .Run ("testLockWorks" , testLockWorks )
81+
82+ t .Cleanup (func () {
83+ for _ , spec := range specs {
84+ t .Log ("Cleaning up " , spec .ImageName )
85+ if err := spec .Cleanup (); err != nil {
86+ t .Error ("Error removing " , spec .ImageName , "error:" , err )
87+ }
88+ }
89+ })
90+ }
91+
92+ func test (t * testing.T ) {
7793 dktesting .ParallelTest (t , specs , func (t * testing.T , c dktest.ContainerInfo ) {
7894 ip , port , err := c .FirstPort ()
7995 if err != nil {
@@ -99,7 +115,7 @@ func Test(t *testing.T) {
99115 })
100116}
101117
102- func TestMigrate (t * testing.T ) {
118+ func testMigrate (t * testing.T ) {
103119 dktesting .ParallelTest (t , specs , func (t * testing.T , c dktest.ContainerInfo ) {
104120 ip , port , err := c .FirstPort ()
105121 if err != nil {
@@ -125,7 +141,7 @@ func TestMigrate(t *testing.T) {
125141 })
126142}
127143
128- func TestWithAuth (t * testing.T ) {
144+ func testWithAuth (t * testing.T ) {
129145 dktesting .ParallelTest (t , specs , func (t * testing.T , c dktest.ContainerInfo ) {
130146 ip , port , err := c .FirstPort ()
131147 if err != nil {
@@ -180,7 +196,7 @@ func TestWithAuth(t *testing.T) {
180196 })
181197}
182198
183- func TestLockWorks (t * testing.T ) {
199+ func testLockWorks (t * testing.T ) {
184200 dktesting .ParallelTest (t , specs , func (t * testing.T , c dktest.ContainerInfo ) {
185201 ip , port , err := c .FirstPort ()
186202 if err != nil {
@@ -241,6 +257,15 @@ func TestTransaction(t *testing.T) {
241257 {ImageName : "mongo:4" , Options : dktest.Options {PortRequired : true , ReadyFunc : isReady ,
242258 Cmd : []string {"mongod" , "--bind_ip_all" , "--replSet" , "rs0" }}},
243259 }
260+ t .Cleanup (func () {
261+ for _ , spec := range transactionSpecs {
262+ t .Log ("Cleaning up " , spec .ImageName )
263+ if err := spec .Cleanup (); err != nil {
264+ t .Error ("Error removing " , spec .ImageName , "error:" , err )
265+ }
266+ }
267+ })
268+
244269 dktesting .ParallelTest (t , transactionSpecs , func (t * testing.T , c dktest.ContainerInfo ) {
245270 ip , port , err := c .FirstPort ()
246271 if err != nil {
0 commit comments