我正在尝试使用SpringBoot,Flyway和H2运行一些测试
我的RestAssured测试类扩展了:
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@EnableConfigurationProperties
public class FunctionalTest {
@LocalServerPort
private int port;
public static final String JDBC_URL = "jdbc:h2:mem:FREE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=MYSQL";
@Value("${spring.datasource.username}")
private String username;
@Value("${spring.datasource.password}")
private String password;
@Before
public void setUp() {
Flyway flyway = new Flyway();
flyway.setDataSource(JDBC_URL, username, password);
flyway.setLocations("classpath:db/migration");
flyway.migrate();
AppContext.loadApplicationContext(this.context);
RestAssured.port = this.port;
CreateEntityUtil.init(organizationRepositoryInj, projectRepositoryInj, apiServerRepositoryInj, userServiceInj, userOrgServiceInj);
}
}
application.properties:
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:FREE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=MYSQL
spring.datasource.username=[EDITED]
spring.datasource.password=[EDITED]
flyway.locations=classpath:db/migration
flyway.schemas=FREE
一些开发人员运行测试,一切都很好。 但是其他人得到以下错误: Flyway找到非空模式
答案 0 :(得分:0)