我想为我编写的每个单元测试运行一个仅在内存中运行的小型PostgreSQL数据库。例如:
@Before
void setUp() {
String port = runPostgresOnRandomPort();
connectTo("postgres://localhost:"+port+"/in_memory_db");
// ...
}
理想情况下,我会将单个postgres可执行文件签入到版本控制中,单元测试将使用该文件。
类似于HSQL
,但适用于postgres。我该怎么做呢?
我能得到这样的Postgres版本吗?我怎样才能指示它不要使用磁盘?
https://stackoverflow.com/questions/7872693
复制相似问题