Skip to content

Commit 76645d4

Browse files
committed
Add access to testcontainer.Container
1 parent 3cc9f54 commit 76645d4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

dep/container/container.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package container provides a wrapper around the testcontainers-go library to simplify container management in tests.
12
package container
23

34
import (
@@ -45,13 +46,20 @@ func (c *Container) Stop() error {
4546
return testcontainers.TerminateContainer(c.c)
4647
}
4748

49+
// Container returns the underlying testcontainers.Container.
50+
func (c *Container) Container() testcontainers.Container {
51+
return c.c
52+
}
53+
54+
// WithReadyFn sets a custom readiness function which should block until ready.
4855
func WithReadyFn(fn func(testcontainers.Container) error) Opt {
4956
return func(c *Container) error {
5057
c.ready = fn
5158
return nil
5259
}
5360
}
5461

62+
// WithModule creates a container using the testcontainers-go modules.
5563
func WithModule[T testcontainers.Container](
5664
runFn func(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (T, error),
5765
img string,
@@ -67,6 +75,7 @@ func WithModule[T testcontainers.Container](
6775
}
6876
}
6977

78+
// WithGenericContainer creates a container using the testcontainers.GenericContainer function.
7079
func WithGenericContainer(req testcontainers.GenericContainerRequest) Opt {
7180
return func(c *Container) (err error) {
7281
c.c, err = testcontainers.GenericContainer(context.Background(), req)

0 commit comments

Comments
 (0)