diff --git a/postgres/lib/testcontainers/postgres.rb b/postgres/lib/testcontainers/postgres.rb index 68ce2c8..57a1bfa 100644 --- a/postgres/lib/testcontainers/postgres.rb +++ b/postgres/lib/testcontainers/postgres.rb @@ -103,6 +103,7 @@ def with_password(password) def _configure add_env("POSTGRES_DATABASE", @database) + add_env("POSTGRES_DB", @database) add_env("POSTGRES_USER", @username) raise ContainerLaunchException, "Password is required for non-root users" if @password.nil? || @password.empty? diff --git a/postgres/test/postgres_container_test.rb b/postgres/test/postgres_container_test.rb index 13a45e4..b75f412 100644 --- a/postgres/test/postgres_container_test.rb +++ b/postgres/test/postgres_container_test.rb @@ -37,6 +37,7 @@ def test_it_returns_the_default_port def test_it_is_configured_with_the_default_environment_variables assert "test", @container.get_env("POSTGRES_DATABASE") + assert "test", @container.get_env("POSTGRES_DB") assert "test", @container.get_env("POSTGRES_USER") assert "test", @container.get_env("POSTGRES_PASSWORD") assert "test", @container.get_env("POSTGRES_ROOT_PASSWORD")