Skip to content

Commit edb3b5d

Browse files
Merge pull request #86 from mchwalek/mch_fix_env_var
Set additional env var for custom postgres db
2 parents 9891413 + a5c8772 commit edb3b5d

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

postgres/lib/testcontainers/postgres.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def with_password(password)
103103

104104
def _configure
105105
add_env("POSTGRES_DATABASE", @database)
106+
add_env("POSTGRES_DB", @database)
106107
add_env("POSTGRES_USER", @username)
107108

108109
raise ContainerLaunchException, "Password is required for non-root users" if @password.nil? || @password.empty?

postgres/test/postgres_container_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def test_it_returns_the_default_port
3737

3838
def test_it_is_configured_with_the_default_environment_variables
3939
assert "test", @container.get_env("POSTGRES_DATABASE")
40+
assert "test", @container.get_env("POSTGRES_DB")
4041
assert "test", @container.get_env("POSTGRES_USER")
4142
assert "test", @container.get_env("POSTGRES_PASSWORD")
4243
assert "test", @container.get_env("POSTGRES_ROOT_PASSWORD")

0 commit comments

Comments
 (0)