Skip to content

Fix flaky NotificationRuleValidationServiceTest #758

@kevinwallimann

Description

@kevinwallimann

Describe the bug

The NotificationRuleValidationServiceTest sometimes fails. Apparently, this is because of two threads that attempt to run the suite at the same time. See https://www.scalatest.org/user_guide/async_testing

To Reproduce

Does not always fail. See e.g. https://github.com/AbsaOSS/hyperdrive-trigger/actions/runs/3711658533/attempts/1

Expected behavior

The test should always pass.

Stacktraces / Screenshots

NotificationRuleValidationServiceTest:
validate
za.co.absa.hyperdrive.trigger.api.rest.services.NotificationRuleValidationServiceTest *** ABORTED ***
  java.util.ConcurrentModificationException: Two threads have apparently attempted to run a suite at the same time. This has resulted in both threads attempting to concurrently change the current Informer. Suite class name: za.co.absa.hyperdrive.trigger.api.rest.services.NotificationRuleValidationServiceTest
  at org.scalatest.AsyncSuperEngine.$anonfun$runImpl$5(AsyncEngine.scala:626)
  at org.scalatest.AsyncSuperEngine.$anonfun$runImpl$5$adapted(AsyncEngine.scala:623)
  at org.scalatest.CompositeStatus.whenCompleted(Status.scala:886)
  at org.scalatest.AsyncSuperEngine.runImpl(AsyncEngine.scala:623)
  at org.scalatest.AsyncFlatSpecLike.run(AsyncFlatSpecLike.scala:1812)
  at org.scalatest.AsyncFlatSpecLike.run$(AsyncFlatSpecLike.scala:1810)
  at za.co.absa.hyperdrive.trigger.api.rest.services.NotificationRuleValidationServiceTest.org$scalatest$BeforeAndAfter$$super$run(NotificationRuleValidationServiceTest.scala:30)
  at org.scalatest.BeforeAndAfter.run(BeforeAndAfter.scala:258)
  at org.scalatest.BeforeAndAfter.run$(BeforeAndAfter.scala:256)
  at za.co.absa.hyperdrive.trigger.api.rest.services.NotificationRuleValidationServiceTest.run(NotificationRuleValidationServiceTest.scala:30)
  ...

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions