-
-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the file and mounts tests into a test package (#2270)
* Move the file and mounts tests into a test package This work has been extracted from #2202 and is related to #2180. See the original PR for the full context and reasoning. This will help with the documentation, since all examples will now have the module prefixes. * Rename the utils file
- Loading branch information
Showing
5 changed files
with
90 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package testcontainers_test | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/testcontainers/testcontainers-go" | ||
) | ||
|
||
func terminateContainerOnEnd(tb testing.TB, ctx context.Context, ctr testcontainers.Container) { | ||
tb.Helper() | ||
if ctr == nil { | ||
return | ||
} | ||
tb.Cleanup(func() { | ||
tb.Log("terminating container") | ||
require.NoError(tb, ctr.Terminate(ctx)) | ||
}) | ||
} |