Selfie JVM Snapshot Garbage Collection is overly zealous when using multiple test suites in gradle
- Vorherrschende Sprache
- Kotlin
- Sterne
- 101
- Forks
- 18
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
In a project I was using a separate integrationTest source set with the JVM Test Suite approach recommended by Gradle [link to instructions](https://docs.gradle.org/current/userguide/jvm_test_suite_plugin.html#sec:declare_an_additional_test_suite).
When done this way, the integration test sources will be in `src/integrationTest` instead of `src/test`. The classes in `src/test` will not be on the classpath of the integration tests.
When running Selfie with JUnit5, the current garbage collection logic is hardcoded to only look for `*.ss` files in `src/test/` and performs a `Class.forName(...)` to see if that test still exists and has tests that match the snapshot. If it doesn't find a match, it deletes the file.
Since the unit tests are invisible on the integrationTest classpath, though, `Class.forName(...)` throws a `ClassNotFoundException` so selfie assumes this is a stale file and deletes. As a consequence, all the unit test snapshots are deleted when running the `integrationTest` task.
Is there some way to get the correct source root from Junit or something like that to avoid deleting unmanaged files?
A reproducer of the described issue can be found here with instructions in the README https://github.com/aelfric/selfie-bug-report-reproducer
Beitragsleitfaden
Rechercherichtung
Beginne mit dem verlinkten Reproducer und seinen README-Anweisungen und verfolge dann Selfie's JUnit5-Snapshot-Garbage-Collection-Logik für separate Gradle-Test-Suites. Reproduziere den integrationTest-Lauf und überprüfe, dass Snapshots unter src/test nicht gelöscht werden, wenn diese Tests im integrationTest-Classpath fehlen. Erledigt ist die Aufgabe, wenn nicht verwaltete Unit-Test-Snapshots intakt bleiben und veraltete Snapshots weiterhin verarbeitet werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java, kotlin
- Bereich
- build-system, testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100