JAkutenshi commented on code in PR #4446: URL: https://github.com/apache/ignite-3/pull/4446#discussion_r1870797812
########## modules/placement-driver-api/src/testFixtures/java/org/apache/ignite/internal/placementdriver/TestPlacementDriver.java: ########## @@ -112,8 +112,29 @@ public Supplier<? extends ReplicaMeta> getPrimaryReplicaSupplier() { return this.primaryReplicaSupplier; } - public void setPrimaryReplicaSupplier(Supplier<? extends ReplicaMeta> primaryReplicaSupplier) { + /** + * Setter for a test primary replica supplier with {@code PRIMARY_REPLICA_ELECTED} event firing that is crucial for some tests internal + * logic that depends on the event handling. + * + * @param primaryReplicaSupplier The supplier that provides {@link TestReplicaMetaImpl} instance with a test primary replica meta + * information. + */ + public void setPrimaryReplicaSupplier(Supplier<? extends TestReplicaMetaImpl> primaryReplicaSupplier) { this.primaryReplicaSupplier = primaryReplicaSupplier; + + TestReplicaMetaImpl replicaMeta = primaryReplicaSupplier.get(); + + fireEvent( + PrimaryReplicaEvent.PRIMARY_REPLICA_ELECTED, + new PrimaryReplicaEventParameters( + 0, Review Comment: TLDR: yes, but tricky. The event is local and if we look at usages, then the only usage of `causalityToken()` from the parameters is `IndexBuildController` that doesn't use in tests. So, we may assume that 0 is safe. I add the corresponding commentary before 0. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org