-
Notifications
You must be signed in to change notification settings - Fork 8
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
[BE2] Fix be2 test db ref injection #1892
Conversation
Pull reviewers statsStats of the last 30 days for popstellar:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not entirely sure what these changes means for the overall design, it reduces a level of indirection in the handlers which is nice but means PublishSubscribe is a hard dependency for the entire system. I don't see any other way to fix the problem you are trying to fix without a larger changes right now so we might as well go that way.
@@ -70,6 +70,7 @@ trait MessageHandler extends AskPatternConstants { | |||
def dbAskWritePropagate(rpcRequest: JsonRpcRequest): Future[GraphMessage] = { | |||
rpcRequest.getParamsMessage match | |||
case Some(m) => | |||
println(s"dbActorWriteAndPropagate : ${dbActor.actorRef}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is might log a bit too much
@@ -214,142 +218,144 @@ class ElectionHandlerTest extends TestKit(ActorSystem("Election-DB-System")) wit | |||
system.actorOf(dbActorMock) | |||
} | |||
|
|||
private def injectDb(dbRef: AskableActorRef) = PublishSubscribe.buildGraph(Actor.noSender, dbRef, Actor.noSender, MessageRegistry(), Actor.noSender, Actor.noSender, Actor.noSender, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use something like: https://www.scalatest.org/scaladoc/1.8/org/scalatest/BeforeAndAfterEach.html ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case not, because different types of mocked db are injected. Using BeforeAndAfterEach would force to inject the same db for all test.
Quality Gate passed for 'PoP - PoPCHA-Web-Client'Issues Measures |
Quality Gate passed for 'PoP - Be2-Scala'Issues Measures |
Quality Gate passed for 'PoP - Be1-Go'Issues Measures |
Agree, buildGraph is tight to adding references to the system, which doesn't seem a natural behaviour. Overall, a lot of references are passed around, eventhought they are unique in the system. We could try to centralize those references using maybe https://doc.akka.io/docs/akka/current/typed/actor-discovery.html as you recommended. |
Quality Gate passed for 'PoP - Fe1-Web'Issues Measures |
Quality Gate passed for 'PoP - Fe2-Android'Issues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fixes the issue of using the wrong refs for the database.
Now all refs from code come from the PublishSubscribe graph, and if something should be injected, it is being done through PublishSubscribe.buildgraph(...)