Package me.ahoo.cosid.test.container
Class PostgresLauncher
java.lang.Object
me.ahoo.cosid.test.container.PostgresLauncher
Provides a real PostgreSQL for backend contract tests.
Uses cosid.test.postgres.url / COSID_TEST_POSTGRES_URL when set, together with
cosid.test.postgres.username / COSID_TEST_POSTGRES_USERNAME and
cosid.test.postgres.password / COSID_TEST_POSTGRES_PASSWORD (both default to postgres).
Otherwise starts a shared PostgreSQL 16 container with an empty cosid_db database.
Tests should skip when isAvailable() is false.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordJDBC connection settings. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic PostgresLauncher.Connectionstatic booleanWhether a PostgreSQL can be provided: an explicit URL is set or Docker is available.
-
Field Details
-
URL_PROPERTY
- See Also:
-
URL_ENV
- See Also:
-
USERNAME_PROPERTY
- See Also:
-
USERNAME_ENV
- See Also:
-
PASSWORD_PROPERTY
- See Also:
-
PASSWORD_ENV
- See Also:
-
-
Method Details
-
isAvailable
public static boolean isAvailable()Whether a PostgreSQL can be provided: an explicit URL is set or Docker is available.- Returns:
- true if
getConnection()can succeed
-
getConnection
-