Use Executor in AbstractWaitStrategy

オープン
#5,253 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
20/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
java, kotlin
領域
testing

調査の方向性

まず core/src/main/java/org/testcontainers/containers/wait/strategy/AbstractWaitStrategy.java を読み、特に EXECUTOR の宣言と waitUntilReady の統合を確認してください。この issue には Kotlin のコルーチンの例がありますが、名前付きテストや受け入れ基準はありません。変更を完了するには、executor を公開または置き換える方法について合意されたアプローチと、中断された wait strategy を検証するための定義された方法が必要です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Java
スター
8.7k
フォーク
1.9k
平均マージ
2日 17時間
マージ済み PR(30日)
9

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

testcontainers/testcontainers-java のほかの issue

testcontainers/testcontainers-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。