From aff632a67a4e96b4f9e7252a1ef2df22e297ffa3 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Fri, 9 Oct 2020 07:06:45 -0400 Subject: [PATCH] tests/pybind/cephfs: cleanup xattrs before starting tests 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 --- src/test/pybind/test_cephfs.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/pybind/test_cephfs.py b/src/test/pybind/test_cephfs.py index dedce84674f..0b2a969b44e 100644 --- a/src/test/pybind/test_cephfs.py +++ b/src/test/pybind/test_cephfs.py @@ -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(): -- 2.39.5