Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Intellij:'docker compose up'在单独的测试运行中?_Java_Mongodb_Intellij Idea_Docker Compose_Spock - Fatal编程技术网

Java Intellij:'docker compose up'在单独的测试运行中?

Java Intellij:'docker compose up'在单独的测试运行中?,java,mongodb,intellij-idea,docker-compose,spock,Java,Mongodb,Intellij Idea,Docker Compose,Spock,我不能使用play按钮在Intellij1中运行单个测试,因为我们的集成测试需要运行mongo,但我可以使用Gradle选项卡运行所有集成测试,因为我们的build.Gradle中有以下内容: task integrationTest(type: Test) { testClassesDir = sourceSets.integrationTest.output.classesDir classpath = sourceSets.integrationTest.runtimeCl

我不能使用play按钮在Intellij1中运行单个测试,因为我们的集成测试需要运行mongo,但我可以使用
Gradle
选项卡运行所有集成测试,因为我们的
build.Gradle
中有以下内容:

task integrationTest(type: Test) {
    testClassesDir = sourceSets.integrationTest.output.classesDir
    classpath = sourceSets.integrationTest.runtimeClasspath
    outputs.upToDateWhen { false }
}

// ...

dockerCompose.isRequiredBy(integrationTest)

dockerCompose {
    useComposeFiles = [rootProject.file('src/test/resources/compose.yml').absolutePath]
    executable = '/usr/local/bin/docker-compose'
    dockerExecutable = '/usr/local/bin/docker'
}
当我从Intellij运行docker compose时,如何让单个测试首先进行
docker compose

[1] :除非我从终端手动启动docker compose,否则请小心使用
src/test/resources
中的一个,而不是
src/main/resources
中的一个,因为它们指向两个不同的数据库,我认为测试清除了测试数据库