summaryrefslogtreecommitdiffstats
path: root/slobrok
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahoo-inc.com>2016-11-14 11:00:27 +0100
committerArne H Juul <arnej@yahoo-inc.com>2016-11-14 11:02:48 +0100
commitdd3fef0ae35e5f8339a3e4fe0ecf6302f18efed6 (patch)
tree9d288eb7d384f320b261316d57c79768cb44708f /slobrok
parent7872c2892b61cab8c878d73b2ee8541210f684e9 (diff)
wait for slobrok server to start first
* since the SlobrokServer is started asynchronously in a different thread it may not be ready immediately. Add a loop retrying the initial connect to stabilize unit test.
Diffstat (limited to 'slobrok')
-rw-r--r--slobrok/src/tests/standalone/standalone.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/slobrok/src/tests/standalone/standalone.cpp b/slobrok/src/tests/standalone/standalone.cpp
index c17875ee571..c4ca8a0012d 100644
--- a/slobrok/src/tests/standalone/standalone.cpp
+++ b/slobrok/src/tests/standalone/standalone.cpp
@@ -118,7 +118,6 @@ public:
TEST("standalone") {
slobrok::SlobrokServer slobrokServer(18541);
Stopper<slobrok::SlobrokServer> ssCleaner(slobrokServer);
- FastOS_Thread::Sleep(300);
FRT_Supervisor orb;
orb.Start();
@@ -130,10 +129,18 @@ TEST("standalone") {
FRT_RPCRequest *req = NULL;
SubReferer<FRT_RPCRequest> reqCleaner(req);
- // test ping against slobrok
- req = orb.AllocRPCRequest(req);
- req->SetMethodName("frt.rpc.ping");
- sb->InvokeSync(req, 5.0);
+ for (int retry=0; retry < 5*61; retry++) {
+ // test ping against slobrok
+ req = orb.AllocRPCRequest(req);
+ req->SetMethodName("frt.rpc.ping");
+ sb->InvokeSync(req, 5.0);
+ if (checkOk(req))
+ break;
+ fprintf(stderr, "ping failed [retry %d]\n", retry);
+ FastOS_Thread::Sleep(200);
+ sb->SubRef();
+ sb = orb.GetTarget(18541);
+ }
ASSERT_TRUE(checkOk(req));
// lookup '*' on empty slobrok