]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tests/pybind/cephfs: cleanup xattrs before starting tests
authorVenky Shankar <vshankar@redhat.com>
Fri, 9 Oct 2020 11:06:45 +0000 (07:06 -0400)
committerVenky Shankar <vshankar@redhat.com>
Tue, 13 Oct 2020 04:29:38 +0000 (00:29 -0400)
Some xattr tests do not fully cleanup set xattrs. Subsequent
tests may expect xattrs to be absent during the test, such as
setting an xattr and then removing followed by checking if the
xattr list to be empty. This may fail if earlier tests do not
cleanup xattrs, especially for root.

So, cleanup xattrs on root before starting tests. Other directories
are removed anyway, so we do not have to bother about those.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/test/pybind/test_cephfs.py

index dedce84674f94dafa44e21be1fdb07f09d40370b..0b2a969b44e5b529766e0ee0ff15ef1bfc2aaeef 100644 (file)
@@ -34,6 +34,11 @@ def setup_test():
     cephfs.closedir(d)
 
     cephfs.chdir(b"/")
+    _, ret_buf = cephfs.listxattr("/")
+    print(f'ret_buf={ret_buf}')
+    xattrs = ret_buf.decode('utf-8').split('\x00')
+    for xattr in xattrs[:-1]:
+        cephfs.removexattr("/", xattr)
 
 @with_setup(setup_test)
 def test_conf_get():