Skip to content

Commit 2664fc4

Browse files
committed
Add a test for dropped requests
1 parent aa62119 commit 2664fc4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

source/geod24/LocalRest.d

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,3 +1342,38 @@ unittest
13421342
node_tid = node_2.tid;
13431343
node_1.check();
13441344
}
1345+
1346+
// request timeouts with dropped messages
1347+
unittest
1348+
{
1349+
static import std.concurrency;
1350+
import std.exception;
1351+
1352+
__gshared C.Tid node_tid;
1353+
1354+
static interface API
1355+
{
1356+
void check ();
1357+
int ping ();
1358+
}
1359+
1360+
static class Node : API
1361+
{
1362+
override int ping () { return 42; }
1363+
1364+
override void check ()
1365+
{
1366+
auto node = new RemoteAPI!API(node_tid, 420.msecs);
1367+
1368+
// Requests are dropped, so it times out
1369+
assert(node.ping() == 42);
1370+
node.ctrl.sleep(10.msecs, true);
1371+
assertThrown!Exception(node.ping());
1372+
}
1373+
}
1374+
1375+
auto node_1 = RemoteAPI!API.spawn!Node();
1376+
auto node_2 = RemoteAPI!API.spawn!Node();
1377+
node_tid = node_2.tid;
1378+
node_1.check();
1379+
}

0 commit comments

Comments
 (0)