我正在使用此依赖项:
<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"
?