testcontainers / testcontainers/testcontainers-java
Use Executor in AbstractWaitStrategy
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 8.7k
- Forks
- 1.9k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 9
Descripción
I am trying to bridge to a suspend version of waitUntilReady in AbstractWaitStrategy with something along the lines of:
suspend fun strategy(waitingStrategyTarget: WaitingStrategyTarget): Unit {
// run your strategy
}
class MyWaitStrategy : AbstractWaitStrategy() {
override fun waitUntilReady() {
val executor: ExecutorService = EXECUTOR // executor from AbstractWaitStrategy
runBlocking(executor.asCoroutineDispatcher()) {
strategy(waitingStrategyTarget)
}
}
}
or in a TestScope with JUnit this may look like:
@Test
fun testWithSuspendedWaitStrategy() =
runTest {
val strategy =
waitStrategy { target ->
// run my strategy
}
// MyContainer.waitUntil(strategy, ....)
}
fun TestScope.waitStrategy(
f: CoroutineScope.(target: WaitStrategyTarget) -> Unit
): AbstractWaitStrategy =
object : AbstractWaitStrategy() {
override fun waitUntilReady() {
launch(EXECUTOR.asCoroutineDispatcher()) {
f(this, waitStrategyTarget)
}
}
}
Is there a way how to implement this with EXECUTOR, being public instead of package private, or with another Executor, ExecutorService or something.
Any Feedback is welcome :D
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza leyendo core/src/main/java/org/testcontainers/containers/wait/strategy/AbstractWaitStrategy.java, especialmente la declaración de EXECUTOR y la integración de waitUntilReady. El issue proporciona ejemplos de corrutinas de Kotlin, pero no incluye pruebas con nombre ni criterios de aceptación; un cambio completado necesitaría un enfoque acordado para exponer o reemplazar el executor y una forma definida de verificar las estrategias de espera suspendidas.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java, kotlin
- Área
- testing
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 20/100