|
|
|
|
|
by c0balt
841 days ago
|
|
Going to the sections for language interactions shows a lot more stuff, e.g., the first full go example: https://testcontainers.com/guides/getting-started-with-testc... Shows how you can embed the declaration of db for testing in a unit test: > pgContainer, err := postgres.RunContainer(ctx,
> testcontainers.WithImage("postgres:15.3-alpine"),
> postgres.WithInitScripts(filepath.Join("..", "testdata", "init-db.sql")),
> postgres.WithDatabase("test-db"),
> postgres.WithUsername("postgres"),
> postgres.WithPassword("postgres"),
> testcontainers.WithWaitStrategy(
> wait.ForLog("database system is ready to accept connections"). This does look quite neat for setting up test specific database instances instead of spawning one outside of the test context with docker(compose). It should also make it possible to run tests that require their own instance in parallel. |
|