SBT recompiles test classes on sbt gatling:testOnly and creates a duplicate of artifacts
See original GitHub issueScala 2.12.6 SBT 1.1.6 Gatling SBT plugin 2.2.2 Gatling 2.3.1
I am creating a Docker image with the Gatling code repo and compile the test sources on image creation with sbt test:compile. I see that compilation indeed succeeds (though runs suspiciously fast):
[info] Compiling 22 Scala sources and 2 Java sources to /src/target/scala-2.12/test-classes ...
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.6. Compiling...
[info] Compilation completed in 6.069s.
[info] Done compiling.
and when I check the target/
directory, I see that test classes were compiled as expected:
docker run -it performance-test:latest
root@ee4f91c4dccf:/src# ls /src/target/scala-2.12/test-classes/com/company/scenarios/
AgentEnrollStressTest.class AgentStressTest.class BaseTest.class DeviceList.class UserCRUD.class VerdictRequest.class
but on sbt gatling:testOnly dummyscenario
I see that SBT recompiles them (and takes considerably longer time):
root@a44495c45b1e:/src# sbt "gatling:testOnly com.company.scenarios.Dummy"
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /src/project
[info] Loading settings from build.sbt ...
[info] Set current project to performance (in build file:/src/)
[info] Updating ...
[info] Done updating.
[info] Compiling 22 Scala sources and 2 Java sources to /src/target/scala-2.12/test-classes ...
[info] Done compiling.
[info] Compiling 22 Scala sources and 2 Java sources to /src/target/scala-2.12/gatling-classes ...
[info] Done compiling.
[info] Simulation(s) execution ended.
[info] No tests to run for Gatling / testOnly
[success] Total time: 39 s, completed Jul 5, 2018 1:58:33 PM
- creates a duplicate in the
target/scala-2.12/gatling-classes
directory:
root@a44495c45b1e:/src# ls /src/target/scala-2.12/test-classes/com/company/scenarios/
AgentEnrollStressTest.class AgentStressTest.class BaseTest.class DeviceList.class UserCRUD.class VerdictRequest.class
root@a44495c45b1e:/src# ls /src/target/scala-2.12/gatling-classes/com/company/scenarios/
AgentEnrollStressTest.class AgentStressTest.class BaseTest.class DeviceList.class UserCRUD.class VerdictRequest.class
Public repository to reproduce: https://github.com/EugeneAbramchuk/performance-public
To build Docker image: docker build -t performance-test:latest --file ./Dockerfile ./ --no-cache
To start in interactive mode: docker run -it performance-test:latest
To trigger the duplicate compilation: sbt "gatling:testOnly dummy"
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Regression happened in sbt 1.1.0.
@slandelle looks like the roots grow deeper.
target/scala-2.12/gatling-classes
are generated ongatling:testOnly
with sbt 1.0.4 too with existingtarget/scala-2.12/test-classes
.Granted, this is an improvement since
testOnly
does not compile twice, but it still occurs when it already hassbt compile
artifacts.