You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Seth Wiesman (Jira)" <ji...@apache.org> on 2021/03/01 16:39:00 UTC
[jira] [Resolved] (FLINK-21324) statefun-testutil can't assert
messages function sends to itself
[ https://issues.apache.org/jira/browse/FLINK-21324?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Seth Wiesman resolved FLINK-21324.
----------------------------------
Resolution: Fixed
> statefun-testutil can't assert messages function sends to itself
> ----------------------------------------------------------------
>
> Key: FLINK-21324
> URL: https://issues.apache.org/jira/browse/FLINK-21324
> Project: Flink
> Issue Type: Bug
> Components: Stateful Functions
> Affects Versions: statefun-2.2.2
> Reporter: Timur
> Assignee: Timur
> Priority: Minor
> Labels: pull-request-available
> Fix For: statefun-3.0.0
>
>
> Assertions don't work for messages sent by functions to themselves. The reason is that TestContext doesn't add a message to responses:
> {code:java}
> @Override
> public void send(Address to, Object message) {
> if (to.equals(selfAddress)) {
> messages.add(new Envelope(self(), to, message));
> return;
> }
> responses.computeIfAbsent(to, ignore -> new ArrayList<>()).add(message);
> }
> {code}
> Instead of adding the message to responses the method returns right after message added to messages.
> Here is the example of the assertion that doesn't work in case a function sent a message to itself:
> {code:java}
> assertThat(harness.invoke(aliceDiseaseDiagnosedEvent()), sentNothing());
> {code}
> The test won't fail even though the message was really sent.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)