【发布时间】:2018-06-26 15:55:32
【问题描述】:
我正在使用这个依赖:
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.5.1</version>
<scope>test</scope>
</dependency>
这是容器,在我的测试中启动:
@ClassRule
public static PostgreSQLContainer postgres = new PostgreSQLContainer()
.withDatabaseName("user")
.withUsername("postgres")
.withPassword("postgres");
但是当我尝试建立与数据库user 的连接时,我收到异常:
PSQLException: FATAL: database "user" does not exist
在此容器中仅显示默认 DB "postgres"。
如何创建数据库"user"?
【问题讨论】:
标签: testcontainers