-
We currently use strings for stages which is error prone, even when there is only one stage. ct := pkgtest.NewConcurrent(t)
ct.Stage("fund", func(t pkgtest.ConcT) {
…
})
…
ct.Wait("fund") I propose it to enable the following usage: stage := pkgtest.NewConcurrent(t).Stage("fund", func(t pkgtest.ConcT) {
…
})
…
stage.Wait() Anther possibility would be to add a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Sometimes, we need to wait for stages that were started somewhere else. For that, we'd need to keep the |
Beta Was this translation helpful? Give feedback.
Sometimes, we need to wait for stages that were started somewhere else. For that, we'd need to keep the
Wait("name")
method. SinceStage
is already a blocking function that implicitly waits for the stage, the above example is technically incorrect. However, if the stage is run inside a goroutine, we need to manually await it when required. For that case, it would be helpful to create aGoStage
series of functions that returns an awaitable reference to the stage, but runs the stage itself in a goroutine.I'm not sure about
WaitAll
, it's kind of risky because it doesn't wait for stages that have not yet been initiated. It's still safest to usect.Wait("stage1", "stage2", ...)
regarding race…