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

Sharding EntityRef for testing, #29267 #29336

Merged
merged 2 commits into from Jul 8, 2020

Conversation

patriknw
Copy link
Member

@patriknw patriknw commented Jul 1, 2020

  • adding a TestEntityRef that forwards tell and ask messages to a given
    probe ActorRef

References #29267

@hseeberger Would this be sufficient for what you requested? See TestEntityRefSpec for how it can be used.

* adding a TestEntityRef that forwards tell and ask messages to a given
  probe ActorRef
@akka-ci akka-ci added the validating PR is currently being validated by Jenkins label Jul 1, 2020
@hseeberger
Copy link
Contributor

Thanks, @patriknw. Looks good, works for me.

If feels a little odd to have this in the compile configuration/scope, but I guess that's better than adding a cluster-sharding-testkit module.

@patriknw
Copy link
Member Author

patriknw commented Jul 1, 2020

If feels a little odd to have this in the compile configuration/scope, but I guess that's better than adding a cluster-sharding-testkit module.

I agree, but I can't motivate another testkit module just for this

@@ -405,43 +401,3 @@ object EntityTypeKey {
EntityTypeKeyImpl(name, messageClass.getName)

}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to separate EntityRef.scala file

"be useful will ClusterShardingStub" in {
val probes = Map("entity-1" -> createTestProbe[String](), "entity-2" -> createTestProbe[String]())

class ClusterShardingStub extends javadsl.ClusterSharding with ClusterSharding {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should make it easier to create a stub of ClusterSharding also?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't yet had the need for that, but this might become useful in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's add that later if/when needed

* Copyright (C) 2019-2020 Lightbend Inc. <https://www.lightbend.com>
*/

package akka.cluster.sharding.typed.scaladsl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we still put it in a testkit named package though?

akka.cluster.sharding.typed.testkit.{javadsl,scaladsl}?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@akka-ci akka-ci added tested PR that was successfully built and tested by Jenkins and removed validating PR is currently being validated by Jenkins labels Jul 1, 2020
@akka-ci
Copy link

akka-ci commented Jul 1, 2020

Test PASSed.

@akka-ci akka-ci added validating PR is currently being validated by Jenkins tested PR that was successfully built and tested by Jenkins and removed tested PR that was successfully built and tested by Jenkins validating PR is currently being validated by Jenkins labels Jul 1, 2020
@akka-ci
Copy link

akka-ci commented Jul 1, 2020

Test PASSed.

Copy link
Member

@johanandren johanandren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@patriknw patriknw closed this Jul 2, 2020
@patriknw patriknw reopened this Jul 2, 2020
Copy link
Member

@chbatey chbatey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* It forwards all messages to the `probe`.
*/
object TestEntityRef {
def of[M](@unused typeKey: EntityTypeKey[M], entityId: String, probe: ActorRef[M]): EntityRef[M] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks find but we sometimes get bitten for not having at least compile only tests for javadsl

@chbatey chbatey added the 2 - pick next Used to mark issues which are next up in the queue to be worked on. The tag is non-binding label Jul 8, 2020
@johanandren johanandren merged commit 2f424b1 into master Jul 8, 2020
@johanandren johanandren deleted the wip-29267-TestEntityRef-patriknw branch July 8, 2020 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 - pick next Used to mark issues which are next up in the queue to be worked on. The tag is non-binding tested PR that was successfully built and tested by Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants