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

Make BehaviorTestKit message adaptation more synchronous #31406

Open
leviramsey opened this issue May 12, 2022 · 0 comments
Open

Make BehaviorTestKit message adaptation more synchronous #31406

leviramsey opened this issue May 12, 2022 · 0 comments
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:testing

Comments

@leviramsey
Copy link
Contributor

(Taking from a discussion in #30050)

As it stands, when using the BehaviorTestKit to test a behavior which performs message adaptation, testing the adaptation requires a call to testkit.runOne() to process the adaptation.

// From BehaviorTestKitSpec.scala
adaptorRef ! 2
testkit.selfInbox().hasMessages should be(true)
testkit.runOne()

The message in the selfInbox is not inspectable and this arguably exposes too much of the internal machinery.

#30050 plumbs the testkit through to the EffectfulActorContext, which allows the completion of the ask to synchronously run message adaptation in the behavior interceptor without going through the selfInbox. A similar approach can be taken with message adaptation to improve ergonomics in the common case.

As with the ask, if a behavior, in response to some message, sets up an adaptation and sends a message to itself, it would now be the responsibility of the test to runOne before sending to the adapter (which is in fact already implicitly the case: in the above test, if there was already a message in the selfInbox it would be run, not the adapted message).

If this change is made, it most likely could not be until 2.7/3.0, due to the potential test breakage.

@johanandren johanandren added 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:testing labels May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:testing
Projects
None yet
Development

No branches or pull requests

2 participants