question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SBT recompiles test classes on sbt gatling:testOnly and creates a duplicate of artifacts

See original GitHub issue

Scala 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:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
slandellecommented, Jul 5, 2018

Regression happened in sbt 1.1.0.

0reactions
EugeneAbramchukcommented, Jul 6, 2018

@slandelle looks like the roots grow deeper.

target/scala-2.12/gatling-classes are generated on gatling:testOnly with sbt 1.0.4 too with existing target/scala-2.12/test-classes.

Granted, this is an improvement since testOnly does not compile twice, but it still occurs when it already has sbt compile artifacts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SBT Plugin - Gatling
This SBT plugin integrates Gatling with SBT, allowing to use Gatling as a testing framework. It can also be used to package your...
Read more >
sbt Reference Manual — Testing
Resources for the test classpath in src/test/resources/. The resources may be accessed from tests by using the getResource methods of java.lang.Class or java....
Read more >
How to run and compile exact one test in sbt? - Stack Overflow
sbt testOnly *className-- -z "test-pattern" : It will run all the tests from that class which spec matchs the pattern defined.
Read more >
Testing Classic Actors • Akka Documentation
The TestKit class contains a collection of tools which makes this common task easy. Scala: copy source import akka.actor.ActorSystem import akka.testkit.{ ...
Read more >
Scala SBT plugin does not understand "compile->compile
compile ->compile;test->test project dependencies are working correctly, test artifacts depends on test artifacts of anorther project. compile->compile;compile-> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found