Skip to content

Instantly share code, notes, and snippets.

@Abdulsametileri
Created November 16, 2022 19:59
Show Gist options
  • Save Abdulsametileri/78fb76132c6ecae90c27e420fb603ddd to your computer and use it in GitHub Desktop.
Save Abdulsametileri/78fb76132c6ecae90c27e420fb603ddd to your computer and use it in GitHub Desktop.
type TestContainerWrapper struct {
container testcontainers.Container
hostPort int
}
type IntegrationTestSuite struct {
suite.Suite
wrapper TestContainerWrapper
}
func (s *IntegrationTestSuite) SetupSuite() {
if err := s.wrapper.RunContainer(); err != nil {
log.Fatalln(err)
}
}
func (s *IntegrationTestSuite) TearDownSuite() {
s.wrapper.CleanUp()
}
func Test_By_Using_Testcontainers(t *testing.T) {
if testing.Short() {
t.Skip()
}
suite.Run(t, new(IntegrationTestSuite))
}
func (s *IntegrationTestSuite) Test_Should_Consume_Successfully() {
// ...
}
func (s *IntegrationTestSuite) Test_Should_Produce_Successfully() {
// ....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment