Commit 103b08ef authored by Joseph Noir's avatar Joseph Noir

Add more tests for autoconnect, remove old tests

parent cf6952f1
...@@ -41,7 +41,12 @@ using std::string; ...@@ -41,7 +41,12 @@ using std::string;
using ping_atom = atom_constant<atom("ping")>; using ping_atom = atom_constant<atom("ping")>;
using pong_atom = atom_constant<atom("pong")>; using pong_atom = atom_constant<atom("pong")>;
using test_one_atom = atom_constant<atom("test_one")>; using set_atom = atom_constant<atom("set")>;
using begin_atom = atom_constant<atom("begin")>;
using middle_atom = atom_constant<atom("middle")>;
using end_atom = atom_constant<atom("end")>;
using msg_atom = atom_constant<atom("msg")>;
using done_atom = atom_constant<atom("shutdown")>; using done_atom = atom_constant<atom("shutdown")>;
/* /*
...@@ -128,39 +133,47 @@ public: ...@@ -128,39 +133,47 @@ public:
} }
}; };
behavior actor_jupiter(event_based_actor* self, actor mars) { struct cache {
return { actor tmp;
[=](test_one_atom) { };
CAF_MESSAGE("sending message from Jupiter to Mars");
self->send(mars, test_one_atom::value, self);
},
[=](done_atom) {
CAF_MESSAGE("Jupiter received message from Earth, shutting down");
self->quit();
}
};
}
behavior actor_mars(event_based_actor* self, actor earth) { behavior test_actor(stateful_actor<cache>* self, std::string location,
bool quit_directly) {
return { return {
[=](done_atom) { [=](set_atom, actor val) {
CAF_MESSAGE("Mars received message from Earth, shutting down"); self->state.tmp = val;
self->quit(); },
[=](begin_atom) {
CAF_REQUIRE(self->state.tmp);
CAF_MESSAGE("starting messaging on " << location);
self->send(self->state.tmp, middle_atom::value, self);
}, },
[=](test_one_atom, actor jupiter) { [=](middle_atom, actor start) {
CAF_MESSAGE("sending message from Mars to Earth"); CAF_REQUIRE(self->state.tmp);
self->send(earth, test_one_atom::value, jupiter, self); CAF_MESSAGE("forwaring message on " << location);
self->send(self->state.tmp, end_atom::value, start, self);
},
[=](end_atom, actor start, actor middle) {
CAF_MESSAGE("message arrived on " << location);
if (quit_directly) {
CAF_MESSAGE("telling other nodes to quit from " << location);
self->send(start, done_atom::value);
self->send(middle, done_atom::value);
self->send(self, done_atom::value);
} else {
CAF_MESSAGE("telling intermediate node to quit from " << location);
self->state.tmp = start;
self->send(middle, done_atom::value);
} }
}; },
} [=](msg_atom) {
CAF_REQUIRE(self->state.tmp);
behavior actor_earth(event_based_actor* self) { CAF_MESSAGE("telling tmp actor to quit from " << location);
return { self->send(self->state.tmp, done_atom::value);
[=](test_one_atom, actor jupiter, actor mars) { self->send(self, done_atom::value);
CAF_MESSAGE("message from Jupiter reached Earth, " },
"replying and shutting down"); [=](done_atom) {
self->send(mars, done_atom::value); CAF_MESSAGE("actor on " << location << " is quitting");
self->send(jupiter, done_atom::value);
self->quit(); self->quit();
} }
}; };
...@@ -172,31 +185,70 @@ CAF_TEST_FIXTURE_SCOPE(autoconn_tcp_simple_test, fixture) ...@@ -172,31 +185,70 @@ CAF_TEST_FIXTURE_SCOPE(autoconn_tcp_simple_test, fixture)
CAF_TEST(build_triangle_simple_tcp) { CAF_TEST(build_triangle_simple_tcp) {
CAF_MESSAGE("setting up Earth"); CAF_MESSAGE("setting up Earth");
auto on_earth = earth.spawn(actor_earth); auto on_earth = earth.spawn(test_actor, "Earth", true);
auto earth_port = earth.middleman().publish(on_earth, 0); auto earth_port = earth.middleman().publish(on_earth, 0);
CAF_REQUIRE(earth_port); CAF_REQUIRE(earth_port);
CAF_MESSAGE("Earth reachable via " << *earth_port); CAF_MESSAGE("Earth reachable via " << *earth_port);
CAF_MESSAGE("setting up Mars"); CAF_MESSAGE("setting up Mars");
auto from_earth = mars.middleman().remote_actor("localhost", *earth_port); auto from_earth = mars.middleman().remote_actor("localhost", *earth_port);
CAF_REQUIRE(from_earth); CAF_REQUIRE(from_earth);
auto on_mars = mars.spawn(actor_mars, *from_earth); auto on_mars = mars.spawn(test_actor, "Mars", true);
anon_send(on_mars, set_atom::value, *from_earth);
auto mars_port = mars.middleman().publish(on_mars, 0); auto mars_port = mars.middleman().publish(on_mars, 0);
CAF_REQUIRE(mars_port); CAF_REQUIRE(mars_port);
CAF_MESSAGE("Mars reachable via " << *mars_port); CAF_MESSAGE("Mars reachable via " << *mars_port);
CAF_MESSAGE("setting up Jupiter"); CAF_MESSAGE("setting up Jupiter");
auto from_mars = jupiter.middleman().remote_actor("localhost", *mars_port); auto from_mars = jupiter.middleman().remote_actor("localhost", *mars_port);
CAF_REQUIRE(from_mars); CAF_REQUIRE(from_mars);
auto on_jupiter = jupiter.spawn(actor_jupiter, *from_mars); auto on_jupiter = jupiter.spawn(test_actor, "Jupiter", true);
anon_send(on_jupiter, set_atom::value, *from_mars);
CAF_MESSAGE("forwarding an actor from Jupiter to Earth via Mars"); CAF_MESSAGE("forwarding an actor from Jupiter to Earth via Mars");
anon_send(on_jupiter, test_one_atom::value); anon_send(on_jupiter, begin_atom::value);
jupiter.await_all_actors_done(); jupiter.await_all_actors_done();
mars.await_all_actors_done(); mars.await_all_actors_done();
earth.await_all_actors_done(); earth.await_all_actors_done();
} }
CAF_TEST(break_triangle_simple_tcp) {
actor on_earth;
actor on_jupiter;
{
simple_config conf;
actor_system mars(conf);
CAF_MESSAGE("setting up Earth");
on_earth = earth.spawn(test_actor, "Earth", false);
auto earth_port = earth.middleman().publish(on_earth, 0);
CAF_REQUIRE(earth_port);
CAF_MESSAGE("Earth reachable via " << *earth_port);
CAF_MESSAGE("setting up Mars");
auto from_earth = mars.middleman().remote_actor("localhost", *earth_port);
CAF_REQUIRE(from_earth);
auto on_mars = mars.spawn(test_actor, "Mars", false);
anon_send(on_mars, set_atom::value, *from_earth);
auto mars_port = mars.middleman().publish(on_mars, 0);
CAF_REQUIRE(mars_port);
CAF_MESSAGE("Mars reachable via " << *mars_port);
CAF_MESSAGE("setting up Jupiter");
auto from_mars = jupiter.middleman().remote_actor("localhost", *mars_port);
CAF_REQUIRE(from_mars);
on_jupiter = jupiter.spawn(test_actor, "Jupiter", false);
anon_send(on_jupiter, set_atom::value, *from_mars);
CAF_MESSAGE("forwarding an actor from Jupiter to Earth via Mars");
anon_send(on_jupiter, begin_atom::value);
mars.await_all_actors_done();
}
anon_send(on_earth, msg_atom::value);
jupiter.await_all_actors_done();
earth.await_all_actors_done();
}
CAF_TEST_FIXTURE_SCOPE_END() CAF_TEST_FIXTURE_SCOPE_END()
CAF_TEST_FIXTURE_SCOPE(autoconn_tcp_test, belt_fixture_t<config>) CAF_TEST_FIXTURE_SCOPE(autoconn_belt_tcp_test, belt_fixture_t<config>)
CAF_TEST(build_triangle_tcp) { CAF_TEST(build_triangle_tcp) {
CAF_MESSAGE("Earth : " << to_string(earth.sys.node())); CAF_MESSAGE("Earth : " << to_string(earth.sys.node()));
...@@ -204,36 +256,37 @@ CAF_TEST(build_triangle_tcp) { ...@@ -204,36 +256,37 @@ CAF_TEST(build_triangle_tcp) {
CAF_MESSAGE("Jupiter: " << to_string(jupiter.sys.node())); CAF_MESSAGE("Jupiter: " << to_string(jupiter.sys.node()));
CAF_MESSAGE("setting up Earth"); CAF_MESSAGE("setting up Earth");
auto on_earth = earth.sys.spawn(actor_earth); auto on_earth = earth.sys.spawn(test_actor, "Earth", true);
// scoped_actor on_earth{earth.sys};
CAF_MESSAGE("run initialization code"); CAF_MESSAGE("run initialization code");
exec_all(); exec_all();
CAF_MESSAGE("prepare connection"); CAF_MESSAGE("prepare connection");
prepare_connection(earth, mars, "earth", port_earth); prepare_connection(earth, mars, "earth", port_earth);
CAF_MESSAGE("publish dummy on earth"); CAF_MESSAGE("publish dummy on earth");
// earth.publish(actor_cast<actor>(on_earth), port_earth);
earth.publish(on_earth, port_earth); earth.publish(on_earth, port_earth);
CAF_MESSAGE("setting up Mars"); CAF_MESSAGE("setting up Mars");
auto from_earth = mars.remote_actor("earth", port_earth); auto from_earth = mars.remote_actor("earth", port_earth);
CAF_REQUIRE(from_earth); CAF_REQUIRE(from_earth);
auto on_mars = mars.sys.spawn(actor_mars, from_earth); auto on_mars = mars.sys.spawn(test_actor, "Mars", true);
anon_send(on_mars, set_atom::value, from_earth);
CAF_MESSAGE("run initialization code"); CAF_MESSAGE("run initialization code");
exec_all(); exec_all();
CAF_MESSAGE("prepare connection"); CAF_MESSAGE("prepare connection");
prepare_connection(mars, jupiter, "mars", port_mars); prepare_connection(mars, jupiter, "mars", port_mars);
CAF_MESSAGE("publish dummy on earth"); CAF_MESSAGE("publish dummy on mars");
mars.publish(on_mars, port_mars); mars.publish(on_mars, port_mars);
CAF_MESSAGE("setting up Jupiter"); CAF_MESSAGE("setting up Jupiter");
auto from_mars = jupiter.remote_actor("mars", port_mars); auto from_mars = jupiter.remote_actor("mars", port_mars);
CAF_REQUIRE(from_mars); CAF_REQUIRE(from_mars);
auto on_jupiter = jupiter.sys.spawn(actor_jupiter, from_mars); auto on_jupiter = jupiter.sys.spawn(test_actor, "Jupiter", true);
anon_send(on_jupiter, set_atom::value, from_mars);
exec_all();
// This handle will be created by the test multiplexer for the automatically // This handle will be created by the test multiplexer for the automatically
// opened socket when automatic connections are enabled. // opened socket when automatic connections are enabled.
auto hdl_jupiter = accept_handle::from_int(std::numeric_limits<int64_t>::max()); auto hdl_jupiter = accept_handle::from_int(std::numeric_limits<int64_t>::max());
// Perpare autmomatic connection between Jupiter and Earth, // Prepare automatic connection between Jupiter and Earth.
prepare_connection(jupiter, earth, "jupiter", port_jupiter, hdl_jupiter); prepare_connection(jupiter, earth, "jupiter", port_jupiter, hdl_jupiter);
// Add the address information for this test to the config server on Mars. // Add the address information for this test to the config server on Mars.
auto mars_config_server = mars.sys.registry().get(atom("ConfigServ")); auto mars_config_server = mars.sys.registry().get(atom("ConfigServ"));
...@@ -246,14 +299,80 @@ CAF_TEST(build_triangle_tcp) { ...@@ -246,14 +299,80 @@ CAF_TEST(build_triangle_tcp) {
anon_send(actor_cast<actor>(mars_config_server), put_atom::value, anon_send(actor_cast<actor>(mars_config_server), put_atom::value,
to_string(jupiter.sys.node()), make_message(addrs)); to_string(jupiter.sys.node()), make_message(addrs));
CAF_MESSAGE("forwarding an actor from Jupiter to Earth via Mars."); CAF_MESSAGE("forwarding an actor from Jupiter to Earth via Mars");
anon_send(on_jupiter, test_one_atom::value); anon_send(on_jupiter, begin_atom::value);
exec_all(); exec_all();
} }
CAF_TEST(break_triangle_tcp) { CAF_TEST(break_triangle_tcp) {
// TODO: Implement the same test as above, but kill the intermediate node CAF_MESSAGE("Earth : " << to_string(earth.sys.node()));
// that helped establish the connection. CAF_MESSAGE("Mars : " << to_string(mars.sys.node()));
CAF_MESSAGE("Jupiter: " << to_string(jupiter.sys.node()));
connection_handle em, me, mj, jm;
CAF_MESSAGE("setting up Earth");
auto on_earth = earth.sys.spawn(test_actor, "Earth", false);
CAF_MESSAGE("run initialization code");
exec_all();
CAF_MESSAGE("prepare connection");
std::tie(em, me) = prepare_connection(earth, mars, "earth", port_earth);
CAF_MESSAGE("publish dummy on earth");
earth.publish(on_earth, port_earth);
CAF_MESSAGE("setting up Mars");
auto from_earth = mars.remote_actor("earth", port_earth);
CAF_REQUIRE(from_earth);
auto on_mars = mars.sys.spawn(test_actor, "Mars", false);
anon_send(on_mars, set_atom::value, from_earth);
CAF_MESSAGE("run initialization code");
exec_all();
CAF_MESSAGE("prepare connection");
std::tie(mj, jm) = prepare_connection(mars, jupiter, "mars", port_mars);
CAF_MESSAGE("publish dummy on mars");
mars.publish(on_mars, port_mars);
CAF_MESSAGE("setting up Jupiter");
auto from_mars = jupiter.remote_actor("mars", port_mars);
CAF_REQUIRE(from_mars);
auto on_jupiter = jupiter.sys.spawn(test_actor, "Jupiter", false);
anon_send(on_jupiter, set_atom::value, from_mars);
exec_all();
// This handle will be created by the test multiplexer for the automatically
// opened socket when automatic connections are enabled.
auto hdl_jupiter = accept_handle::from_int(std::numeric_limits<int64_t>::max());
// Prepare automatic connection between Jupiter and Earth.
prepare_connection(jupiter, earth, "jupiter", port_jupiter, hdl_jupiter);
// Add the address information for this test to the config server on Mars.
auto mars_config_server = mars.sys.registry().get(atom("ConfigServ"));
network::address_listing interfaces{
{network::protocol::ipv4, std::vector<std::string>{"jupiter"}}
};
basp::routing_table::address_map addrs{
{network::protocol::tcp, {port_jupiter, interfaces}}
};
anon_send(actor_cast<actor>(mars_config_server), put_atom::value,
to_string(jupiter.sys.node()), make_message(addrs));
CAF_MESSAGE("forwarding an actor from Jupiter to Earth via Mars");
anon_send(on_jupiter, begin_atom::value);
exec_all();
// TODO: Shut everything the intermediate node
// - send disconnect messages (i.e., detach the related scribes)
// - shutdown the broker
// - do something about the scribes?
earth.mpx.detach(em, true);
mars.mpx.detach(me, true);
mars.mpx.detach(mj, true);
jupiter.mpx.detach(jm, true);
exec_all();
anon_send_exit(mars.basp, exit_reason::kill);
exec_all();
anon_send(on_earth, msg_atom::value);
exec_all();
} }
CAF_TEST_FIXTURE_SCOPE_END() CAF_TEST_FIXTURE_SCOPE_END()
...@@ -768,229 +768,4 @@ CAF_TEST(read_address_after_handshake) { ...@@ -768,229 +768,4 @@ CAF_TEST(read_address_after_handshake) {
); );
} }
/*
CAF_TEST(build_connections) {
// this node receives a message from jupiter via mars and responds via mars
// and any ad-hoc automatic connection requests are ignored
CAF_MESSAGE("self: " << to_string(self()->address()));
CAF_MESSAGE("publish self at port 4242");
auto ax = accept_handle::from_int(4242);
mpx()->provide_acceptor(4242, ax);
sys.middleman().publish(self(), 4242);
mpx()->flush_runnables(); // process publish message in basp_broker
CAF_MESSAGE("connect to Mars");
connect_node(mars(), ax, self()->id());
CAF_MESSAGE("actor from Jupiter sends a message to us via Mars");
auto mx = mock(mars().connection,
{basp::message_type::dispatch_message, 0, 0, 0,
jupiter().id, this_node(),
jupiter().dummy_actor->id(), self()->id()},
std::vector<actor_id>{},
make_message("hello from jupiter!"));
CAF_MESSAGE("expect ('sys', 'get', \"info\") from Earth to Jupiter at Mars");
// this asks Jupiter if it has a 'SpawnServ'
mx.receive(mars().connection,
basp::message_type::dispatch_message,
basp::header::named_receiver_flag, any_vals,
no_operation_data, this_node(), jupiter().id,
any_vals, invalid_actor_id,
spawn_serv_atom,
std::vector<actor_id>{},
make_message(sys_atom::value, get_atom::value, "info"));
CAF_MESSAGE("expect announce_proxy message at Mars from Earth to Jupiter");
mx.receive(mars().connection,
basp::message_type::announce_proxy, no_flags, no_payload,
no_operation_data, this_node(), jupiter().id,
invalid_actor_id, jupiter().dummy_actor->id());
CAF_MESSAGE("receive message from jupiter");
self()->receive(
[](const std::string& str) -> std::string {
CAF_CHECK_EQUAL(str, "hello from jupiter!");
return "hello from earth!";
}
);
mpx()->exec_runnable(); // process forwarded message in basp_broker
mock()
.receive(mars().connection,
basp::message_type::dispatch_message, no_flags, any_vals,
no_operation_data, this_node(), jupiter().id,
self()->id(), jupiter().dummy_actor->id(),
std::vector<actor_id>{},
make_message("hello from earth!"));
}
*/
CAF_TEST(automatic_connection) {
// jupiter [remote hdl 0] -> mars [remote hdl 1] -> earth [this_node]
// (this node receives a message from jupiter via mars and responds via mars,
// but then also establishes a connection to jupiter directly)
/*
CAF_MESSAGE("! This test case changes the node id and dummy actor of jupiter\n"
" to a different actor system to trigger the creation of a\n"
" proxy on receipt of the dummy actor.");
// Create a new system to have an actor with an id from a remote system
// to test the automatic connection setup.
actor_system_config fake_cfg;
fake_cfg.load<caf::io::middleman>();
actor_system fake_sys(fake_cfg);
scoped_actor another_fake_actor(fake_sys);
new (&jupiter().dummy_actor) scoped_actor(fake_sys);
jupiter().id = fake_sys.node();
CAF_MESSAGE("Jupiter: " << to_string(jupiter().id));
*/
/*
auto check_node_in_tbl = [&](node& n) {
io::id_visitor id_vis;
auto lr = tbl().lookup(n.id);
CAF_REQUIRE(lr.hdl);
CAF_CHECK_EQUAL(visit(id_vis, *lr.hdl), n.connection.id());
};
mpx()->provide_scribe("jupiter", 8080, jupiter().connection);
CAF_CHECK(mpx()->has_pending_scribe("jupiter", 8080));
CAF_MESSAGE("Earth actor : " << to_string(self()));
CAF_MESSAGE("Jupiter actor: " << to_string(jupiter().dummy_actor));
CAF_MESSAGE("Mars actor : " << to_string(mars().dummy_actor));
auto ax = accept_handle::from_int(4242);
mpx()->provide_acceptor(4242, ax);
publish(self(), 4242);
mpx()->flush_runnables(); // process publish message in basp_broker
CAF_MESSAGE("connect to mars");
auto& addrs = instance().tbl().local_addresses();
connect_node(mars(), ax, self()->id(), std::set<string>{}, addrs);
//CAF_CHECK_EQUAL(tbl().lookup_direct(mars().id).id(), mars().connection.id());
check_node_in_tbl(mars());
// TODO:
// - Send Jupiter's actor from mars to Earth.
// - Expect the ConfigServ msg at Mars.
// - Reply with the connection info for Mars.
// - Handle the direct handshake.
// - Sounds about right!
// Our dummy actors all belong to the same system,
// here is a fake actor from Jupiter.
// TODO: Should really be an actor ...
CAF_MESSAGE("Mars shares an actor located at Jupiter with Earth.");
// TODO: This fails. Apparently it is not the same thing, sending the actor
// or forwardings an actor received earlier. Not sure how to solve this, yet.
mock(mars().connection,
{basp::message_type::dispatch_message, 0, 0, 0,
mars().id, this_node(),
mars().dummy_actor->id(), self()->id()},
std::vector<actor_id>{},
make_message("Here is jupiter's actor!", on_phobos));
// CAF_MESSAGE("Receive the msg from Mars");
// self()->receive(
// [&](std::string& text, actor sender) {
// CAF_MESSAGE("Received '" << text << "' from '"
// << to_string(sender) << "'.");
// CAF_MESSAGE("Self is '" << to_string(self()) << "'.");
// }
// );
CAF_MESSAGE("Earth announces a proxy for the sender from Mars.");
mock()
.receive(mars().connection,
basp::message_type::announce_proxy,
no_flags, no_payload, no_operation_data,
this_node(), mars().id,
invalid_actor_id, mars().dummy_actor->id());
sched.run();
mpx()->flush_runnables();
CAF_MESSAGE("Earth requests connection info for Jupiter");
mock()
.receive(mars().connection,
basp::message_type::dispatch_message,
basp::header::named_receiver_flag, any_vals, no_operation_data,
this_node(), mars().id, any_vals, invalid_actor_id,
config_serv_atom,
std::vector<actor_id>{},
make_message(get_atom::value, to_string(jupiter().id)));
*/
/*
CAF_MESSAGE("simulate that an actor from jupiter "
"sends a message to us via mars");
mock(mars().connection,
{basp::message_type::dispatch_message, 0, 0, 0,
jupiter().id, this_node(),
jupiter().dummy_actor->id(), self()->id()},
std::vector<actor_id>{},
make_message("hello from jupiter!"))
.receive(mars().connection,
basp::message_type::dispatch_message,
basp::header::named_receiver_flag, any_vals, no_operation_data,
this_node(), jupiter().id, any_vals, invalid_actor_id,
spawn_serv_atom,
std::vector<actor_id>{},
make_message(sys_atom::value, get_atom::value, "info"))
.receive(mars().connection,
basp::message_type::dispatch_message,
basp::header::named_receiver_flag, any_vals,
no_operation_data, this_node(), jupiter().id,
any_vals, // actor ID of an actor spawned by the BASP broker
invalid_actor_id,
config_serv_atom,
std::vector<actor_id>{},
make_message(get_atom::value, "basp.default-connectivity-tcp"))
.receive(mars().connection,
basp::message_type::announce_proxy, no_flags, no_payload,
no_operation_data, this_node(), jupiter().id,
invalid_actor_id, jupiter().dummy_actor->id());
CAF_CHECK_EQUAL(mpx()->output_buffer(mars().connection).size(), 0u);
CAF_CHECK_EQUAL(*tbl().lookup(jupiter().id).hdl, mars().id);
CAF_CHECK_EQUAL(tbl().lookup(mars().id), none);
auto connection_helper_actor = sys.latest_actor_id();
CAF_CHECK_EQUAL(mpx()->output_buffer(mars().connection).size(), 0u);
// create a dummy config server and respond to the name lookup
CAF_MESSAGE("receive ConfigServ of jupiter");
network::address_listing res;
res[network::protocol::ipv4].emplace_back("jupiter");
mock(mars().connection,
{basp::message_type::dispatch_message, 0, 0, 0,
this_node(), jupiter(),
invalid_actor_id, connection_helper_actor},
std::vector<actor_id>{},
make_message("basp.default-connectivity-tcp",
make_message(uint16_t{8080}, std::move(res))));
// our connection helper should now connect to jupiter and
// send the scribe handle over to the BASP broker
while (mpx()->has_pending_scribe("jupiter", 8080)) {
sched.run();
mpx()->flush_runnables();
}
CAF_REQUIRE(mpx()->output_buffer(mars().connection).empty());
// send handshake from jupiter
mock(jupiter().connection,
{basp::message_type::server_handshake, 0, 0, basp::version,
jupiter().id, none,
jupiter().dummy_actor->id(), invalid_actor_id},
std::string{},
jupiter().dummy_actor->id(),
uint32_t{0})
.receive(jupiter().connection,
basp::message_type::client_handshake, no_flags, 1u,
no_operation_data, this_node(), jupiter().id,
invalid_actor_id, invalid_actor_id, std::string{});
CAF_CHECK_EQUAL(tbl().lookup(jupiter().id).hdl, none);
CAF_CHECK_EQUAL(tbl().lookup(mars().id).hdl, none);
check_node_in_tbl(jupiter());
check_node_in_tbl(mars());
CAF_MESSAGE("receive message from jupiter");
self()->receive(
[](const std::string& str) -> std::string {
CAF_CHECK_EQUAL(str, "hello from jupiter!");
return "hello from earth!";
}
);
mpx()->exec_runnable(); // process forwarded message in basp_broker
CAF_MESSAGE("response message must take direct route now");
mock()
.receive(jupiter().connection,
basp::message_type::dispatch_message, no_flags, any_vals,
no_operation_data, this_node(), jupiter().id,
self()->id(), jupiter().dummy_actor->id(),
std::vector<actor_id>{},
make_message("hello from earth!"));
CAF_CHECK_EQUAL(mpx()->output_buffer(mars().connection).size(), 0u);
*/
}
CAF_TEST_FIXTURE_SCOPE_END() CAF_TEST_FIXTURE_SCOPE_END()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment