Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ActorRef injection through PublishSubscribe creates inconsistencies in tests #1870

Closed
1 of 6 tasks
DanielTavaresA opened this issue May 16, 2024 · 2 comments · Fixed by #1892
Closed
1 of 6 tasks
Labels
be2-scala bug Something isn't working

Comments

@DanielTavaresA
Copy link
Collaborator

DanielTavaresA commented May 16, 2024

Description (Actual behavior)

When running the full test suite in Scala, test("rumor handler should process messages received in a rumor") fails, but when running only RumorHandlerSuite this test passes.

Expected behavior

We expect that tests shouldn't have dependencies and test("rumor handler should process messages received in a rumor") should succeed independently of previous tests

How to reproduce

  1. Run all scala test suite at once
  2. Run only RumorHandlerSuite

Version & Environment

This bug was reproduced on:

Front-ends:
  • Fe1-Web (please include browser's names & version)
  • Fe2-Android (please specify if phone or emulation, and Android version)
  • Not applicable
Back-ends:
  • Be1-Go
  • Be2-Scala
  • Not applicable

Workaround

PoP System is still usable as usual, this issue only raises in tests. To still be able to test, failing test should be uncommented and run only `RumorHandlerSuite

Impact

This issue prevents two different tests suites from testing if the processing of messages received within a Rumor or GetMsgByIdAns is done correctly.

Possible root cause

Root cause comes from PublishSubscribe.buildGraph injection of reference for the dbActor. RumorHandlerSuitetries to reference a dbActor that was created within GetMessagesByIdResponseHandlerSuiteSystem, which fails because it was terminated. This reference comes from different handlers that rely on getDbActorReffrom PublishSubscribe. This injection is necessary to test that messages are handled correctly, but if done in two separate test suites, it seems that some classes still reference and old one.

@DanielTavaresA
Copy link
Collaborator Author

Reference from Db is shared between tests through objects handlers. final lazy val handlerInstance is created once, with first ActorSystem sharing its dbRef. This dbRef is then shared accross tests causing errors.

@DanielTavaresA
Copy link
Collaborator Author

Creating a MessageRegistery calls ElectionHandler, RollcallHandler, SocialHandler and WitnessHandler . Once a call to this handler happens in one test, the instance is set and final for all test suites.

@DanielTavaresA DanielTavaresA linked a pull request May 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
be2-scala bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant