]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rest-api.py: test that ceph-rest-api is up and servicing requests
authorDan Mick <dan.mick@inktank.com>
Wed, 2 Oct 2013 21:25:03 +0000 (14:25 -0700)
committerDan Mick <dan.mick@inktank.com>
Wed, 2 Oct 2013 21:58:11 +0000 (14:58 -0700)
Wait for the daemon to actually be ready before continuing with other
tasks.  Loop 12 times, waiting 5s, before deciding something's wrong.

Fixes: #6243
Signed-off-by: Dan Mick <dan.mick@inktank.com>
teuthology/task/rest-api.py

index 4028f4773c8a92d108068d1f58d2d545f92bc3c3..c7ba628b52a2bb93e08bcab4e5baf60e9c736e27 100644 (file)
@@ -1,5 +1,6 @@
 import logging
 import contextlib
+import time
 
 from teuthology import misc as teuthology
 from teuthology import contextutil
@@ -33,6 +34,24 @@ def run_rest_api_daemon(ctx, api_clients):
                     stdin=run.PIPE,
                     wait=False,
                     )
+                for i in range(1, 12):
+                    log.info('testing for ceph-rest-api try {0}'.format(i))
+                    run_cmd = [
+                        'wget',
+                        '-O',
+                        '/dev/null',
+                        '-q',
+                        'http://localhost:5000/api/v0.1/status'
+                    ]
+                    proc = rems.run(
+                        args=run_cmd,
+                        check_status=False
+                    )
+                    if proc.exitstatus == 0:
+                        break
+                    time.sleep(5)
+                if proc.exitstatus != 0:
+                    raise RuntimeError('Cannot contact ceph-rest-api')
     try:
         yield