diffplug / diffplug/selfie

Selfie JVM Snapshot Garbage Collection is overly zealous when using multiple test suites in gradle

Abierto
#574 2 comentarios 0 reacciones 0 asignados Ver en GitHub
bug jvm
Lenguaje dominante
Kotlin
Estrellas
101
Forks
18
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con el reproductor enlazado y sus instrucciones del README; después, sigue la lógica de recolección de basura de snapshots de JUnit5 de Selfie para suites de pruebas de Gradle independientes. Reproduce la ejecución de integrationTest y verifica que los snapshots bajo src/test no se eliminen cuando esas pruebas no estén presentes en el classpath de integrationTest. Se considera terminado cuando los snapshots de pruebas unitarias no gestionados permanecen intactos y los snapshots obsoletos siguen gestionándose.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java, kotlin
Área
build-system, testing-qa
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.