Skip to content

Commit b574662

Browse files
committed
Fix race between withNoVettedPackages and app init package vetting
[ci] Signed-off-by: Oriol Muñoz <oriol.munoz@digitalasset.com>
1 parent f1dfad1 commit b574662

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

apps/app/src/test/scala/org/lfdecentralizedtrust/splice/integration/EnvironmentDefinition.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ import org.scalatest.{Inside, Inspectors, OptionValues}
4545
case class EnvironmentDefinition(
4646
override val baseConfig: SpliceConfig,
4747
override val testingConfig: TestingConfigInternal = TestingConfigInternal(),
48+
// preSetup and setup run *after* the apps have started, but before tests run.
49+
// preAppStart runs before the apps are started.
50+
preAppStart: SpliceTestConsoleEnvironment => Unit = _ => (),
4851
val preSetup: SpliceTestConsoleEnvironment => Unit = _ => (),
4952
val setup: SpliceTestConsoleEnvironment => Unit = _ => (),
5053
override val teardown: Unit => Unit = _ => (),
@@ -174,8 +177,7 @@ case class EnvironmentDefinition(
174177
participants: SpliceTestConsoleEnvironment => Seq[ParticipantClientReference]
175178
): EnvironmentDefinition = {
176179
copy(
177-
preSetup = implicit env => {
178-
this.preSetup(env)
180+
preAppStart = implicit env => {
179181
participants(env).foreach { p =>
180182
p.synchronizers.list_connected().foreach { connected =>
181183
val currentVettedPackages = p.topology.vetted_packages.list(
@@ -471,15 +473,17 @@ case class EnvironmentDefinition(
471473
override def createTestConsole(
472474
environment: SpliceEnvironment,
473475
loggerFactory: NamedLoggerFactory,
474-
): TestConsoleEnvironment[SpliceConfig, SpliceEnvironment] =
475-
new SpliceConsoleEnvironment(
476+
): TestConsoleEnvironment[SpliceConfig, SpliceEnvironment] = {
477+
val env = new SpliceConsoleEnvironment(
476478
environment,
477479
new TestConsoleOutput(loggerFactory),
478480
) with TestEnvironment[SpliceConfig] {
479481
override lazy val actorSystem = super[TestEnvironment].actorSystem
480482
override val actualConfig: SpliceConfig = this.environment.config
481-
482483
}
484+
this.preAppStart(env)
485+
env
486+
}
483487
}
484488

485489
object EnvironmentDefinition extends CommonAppInstanceReferences {

0 commit comments

Comments
 (0)