Skip to content

coverage data does not survive remote cache push-pull #421

Open
@vlfig

Description

@vlfig

I'm a bit unsure where to post this but here goes.

coverageDataDir + "/scoverage-data/" doesn't get cached on pushRemoteCache. This breaks tests on instrumented code.

Example script below:

  1. clean
  2. test with coverage - fine
  3. clean
  4. compile tests with coverage
  5. push cache
  6. clean
  7. pull cache
  8. run tests with coverage - error FileNotFoundException
sbt:my-module> clean
[success] Total time: 0 s, completed 10 Feb 2022, 12:08:39
sbt:my-module> ;coverage ;test
[snip]
[info] Wrote instrumentation file [/home/user/projects/acme/my-project/my-module/target/scala-2.13/scoverage-data/scoverage.coverage]
[info] Will write measurement data to [/home/user/projects/acme/my-project/my-module/target/scala-2.13/scoverage-data]
[snip]
[info] All tests passed.
sbt:my-module> clean
[success] Total time: 0 s, completed 10 Feb 2022, 12:09:06
sbt:my-module> ;coverage ;Test/compile
[snip]
[info] Wrote instrumentation file [/home/user/projects/acme/my-project/my-module/target/scala-2.13/scoverage-data/scoverage.coverage]
[info] Will write measurement data to [/home/user/projects/acme/my-project/my-module/target/scala-2.13/scoverage-data]
[snip]
sbt:my-module> pushRemoteCache
[warn] multiple main classes detected: run 'show discoveredMainClasses' to see the list
[info]  published my-module_2.13 to file:/home/user/projects/acme/my-project/sbt-cache/com/acme/my-module_2.13/0.0.0-305a5886860cd5d4/my-module_2.13-0.0.0-305a5886860cd5d4-cached-compile.jar
[info]  published my-module_2.13 to file:/home/user/projects/acme/my-project/sbt-cache/com/acme/my-module_2.13/0.0.0-840291a3ca4253fe/my-module_2.13-0.0.0-840291a3ca4253fe-cached-test.jar
[success] Total time: 0 s, completed 10 Feb 2022, 12:09:19
sbt:my-module> clean
[success] Total time: 0 s, completed 10 Feb 2022, 12:09:26
sbt:my-module> pullRemoteCache
[info] remote cache artifact extracted for com.acme:my-module:0.0.0-305a5886860cd5d4 Some(cached-compile)
[info] remote cache artifact extracted for com.acme:my-module:0.0.0-840291a3ca4253fe Some(cached-test)
[success] Total time: 0 s, completed 10 Feb 2022, 12:09:28
sbt:my-module> ;coverage ;test
[snip]
[info] > Exception: java.io.FileNotFoundException: /home/user/projects/acme/my-project/my-module/target/scala-2.13/scoverage-data/scoverage.measurements.b0dad2a4-06f7-44be-ab65-77ef8631ae71.15 (No such file or directory)
[info] > Exception: java.io.FileNotFoundException: /home/user/projects/acme/my-project/my-module/target/scala-2.13/scoverage-data/scoverage.measurements.b0dad2a4-06f7-44be-ab65-77ef8631ae71.15 (No such file or directory)
[snip]
[info] *** x TESTS FAILED ***

Maybe tweak ThisBuild / Compile / pushRemoteCacheConfiguration / remoteCacheArtifacts?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions