Created
November 16, 2022 19:59
-
-
Save Abdulsametileri/78fb76132c6ecae90c27e420fb603ddd to your computer and use it in GitHub Desktop.
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
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