Skip to content

Commit

Permalink
feat: Bump default postgres version (#2481)
Browse files Browse the repository at this point in the history
* Bump default postgres version

* Bump to use latest pg

* Bump version from non-ancient version

---------

Co-authored-by: bstrausser <bstrausser@locusrobotics.com>
  • Loading branch information
bearrito and bstrausser committed Apr 15, 2024
1 parent b5f1e13 commit 4002fc2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/modules/postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ When starting the Postgres container, you can pass options in a variadic way to
#### Image

If you need to set a different Postgres Docker image, you can use `testcontainers.WithImage` with a valid Docker image
for Postgres. E.g. `testcontainers.WithImage("docker.io/postgres:9.6")`.
for Postgres. E.g. `testcontainers.WithImage("docker.io/postgres:16-alpine")`.

{% include "../features/common_functional_options.md" %}

Expand Down
2 changes: 1 addition & 1 deletion modules/postgres/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func ExampleRunContainer() {
dbPassword := "password"

postgresContainer, err := postgres.RunContainer(ctx,
testcontainers.WithImage("docker.io/postgres:15.2-alpine"),
testcontainers.WithImage("docker.io/postgres:16-alpine"),
postgres.WithInitScripts(filepath.Join("testdata", "init-user-db.sh")),
postgres.WithConfigFile(filepath.Join("testdata", "my-postgres.conf")),
postgres.WithDatabase(dbName),
Expand Down
5 changes: 2 additions & 3 deletions modules/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
const (
defaultUser = "postgres"
defaultPassword = "postgres"
defaultPostgresImage = "docker.io/postgres:11-alpine"
defaultPostgresImage = "docker.io/postgres:16-alpine"
defaultSnapshotName = "migrated_template"
)

Expand All @@ -26,10 +26,9 @@ type PostgresContainer struct {
snapshotName string
}


// MustConnectionString panics if the address cannot be determined.
func (c *PostgresContainer) MustConnectionString(ctx context.Context, args ...string) string {
addr, err := c.ConnectionString(ctx,args...)
addr, err := c.ConnectionString(ctx, args...)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 4002fc2

Please sign in to comment.