]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: check immutable object cache content 37110/head
authorYin Congmin <congmin.yin@intel.com>
Mon, 7 Sep 2020 07:24:56 +0000 (15:24 +0800)
committerYin Congmin <congmin.yin@intel.com>
Sun, 20 Sep 2020 17:36:56 +0000 (01:36 +0800)
fix check immutable cache does not work

Signed-off-by: Yin Congmin <congmin.yin@intel.com>
qa/tasks/immutable_object_cache.py

index 0635c9702902a5bdbe3267fb3b37b921e0bdae30..b8034de4702e7686c15c3e8312447bb54a102f42 100644 (file)
@@ -32,16 +32,22 @@ def immutable_object_cache(ctx, config):
     try:
         yield
     finally:
-        log.info("cleanup immutable object cache")
+        log.info("check and cleanup immutable object cache")
         for client, client_config in config.items():
             client_config = client_config if client_config is not None else dict()
             (remote,) = ctx.cluster.only(client).remotes.keys()
+            cache_path = client_config.get('immutable object cache path', '/tmp/ceph-immutable-object-cache')
+            ls_command = '"$(ls {} )"'.format(cache_path)
+            remote.run(
+                args=[
+                    'test', '-n', run.Raw(ls_command),
+                    ]
+                )
             remote.run(
                 args=[
                     'sudo', 'killall', '-s', '9', 'ceph-immutable-object-cache', run.Raw('||'), 'true',
                     ]
                 )
-            cache_path = client_config.get('immutable object cache path', '/tmp/ceph-immutable-object-cache')
             remote.run(
                 args=[
                     'sudo', 'rm', '-rf', cache_path, run.Raw('||'), 'true',