Skip to content

[Enhancement]: incomplete documentation for postgres example #1362

@ChristianSch

Description

@ChristianSch

Proposal

Hi there,

As the postgres docs are based on the https://github.com/testcontainers/testcontainers-go/blob/7ae3f5ae950813ea3fe1b071f7a17012d222f2dd/modules/postgres/postgres_test.go, it produces code which is unusable. It is not clear what tt is from the context. You can't really know it, as it's rest related. Any change this could get fixed up?

It should really be something along the lines of:

	"github.com/testcontainers/testcontainers-go"
	testpg "github.com/testcontainers/testcontainers-go/modules/postgres"
	"github.com/testcontainers/testcontainers-go/wait"

	container, err := testpg.RunContainer(ctx,
		testcontainers.WithImage("docker.io/postgres:15.2-alpine"),
		testpg.WithDatabase("test"),
		testpg.WithUsername("test"),
		testpg.WithPassword("test"),
		testcontainers.WithWaitStrategy(
			wait.ForLog("database system is ready to accept connections").
				WithOccurrence(2).
				WithStartupTimeout(5*time.Second)),
	)

Instead of:

image

In theory I'm up for submitting a patch, but I really don't want to meddle with tests and doc generation processes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions