Skip to content

Commit

Permalink
Fixed readme with testcontainers
Browse files Browse the repository at this point in the history
Signed-off-by: Gianluca Arbezzano <[email protected]>
  • Loading branch information
Gianluca Arbezzano committed Jan 8, 2019
1 parent 16d4ed1 commit 47c0da6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ import (
"net/http"
"testing"

testcontainer "github.com/testcontainers/testcontainer-go"
testcontainers "github.com/testcontainers/testcontainers-go"
)

func TestNginxLatestReturn(t *testing.T) {
ctx := context.Background()
req := testcontainer.ContainerRequest{
req := testcontainers.ContainerRequest{
Image: "nginx",
ExposedPorts: []string{"80/tcp"},
}
nginxC, err := testcontainer.GenericContainer(ctx, testcontainer.GenericContainerRequest{
nginxC, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: req,
Started: true,
})
Expand Down Expand Up @@ -66,11 +66,11 @@ suppose you are testing an application that requites redis:
```go
func TestRedisPing(t *testing.T) {
ctx := context.Background()
req := testcontainer.ContainerRequest{
req := testcontainers.ContainerRequest{
Image: "redis",
ExposedPorts: []string{"6379/tcp"},
}
redisC, err := testcontainer.GenericContainer(ctx, testcontainer.GenericContainerRequest{
redisC, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
ContainerRequest: req,
Started: true,
})
Expand All @@ -87,13 +87,13 @@ func TestRedisPing(t *testing.T) {
t.Error(err)
}

appReq := testcontainer.ContainerRequest{
appReq := testcontainers.ContainerRequest{
ExposedPorts: []string{"8081/tcp"},
Env: map[string]string{
"REDIS_HOST": fmt.Sprintf("http://%s:%s", ip, redisPort.Port()),
},
}
appC, err := testcontainer.RunContainer(ctx, "your/app", testcontainer.GenericContainerRequest{
appC, err := testcontainers.RunContainer(ctx, "your/app", testcontainers.GenericContainerRequest{
ContainerRequest: appReq,
Started: true,
})
Expand Down

0 comments on commit 47c0da6

Please sign in to comment.