Selfie JVM Snapshot Garbage Collection is overly zealous when using multiple test suites in gradle
- Langage dominant
- Kotlin
- Étoiles
- 101
- Forks
- 18
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par le reproducer lié et ses instructions du README, puis suivez la logique de garbage collection des snapshots JUnit5 de Selfie pour des suites de tests Gradle distinctes. Reproduisez l’exécution de integrationTest et vérifiez que les snapshots sous src/test ne sont pas supprimés lorsque ces tests sont absents du classpath de integrationTest. C’est terminé lorsque les snapshots de tests unitaires non gérés restent intacts tandis que les snapshots obsolètes continuent d’être traités.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java, kotlin
- Domaine
- build-system, testing-qa
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- Plutôt claire
- Accessibilité débutants
- 48/100