I ran into this failure once #54972 was merged. The test is validating
the error string returned due to the failed mount. There aren't any
return value checks - which is a _more_ important check. Generic error
string checks will fail once a (error) string is changed (typo, etc..).
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Instead of writing something as long as
"self.mds_cluster.mon_manager.run_cluster_cmd()" to execute a command,
let's add a helper method to class CephFSTestCase and use it instead.
With this, running a command becomes simple - "self.run_ceph_cmd()".
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Class CapTester contains two distinct immiscible group of methods: one
that tests MON caps and other that tests MDS caps. When using CapTester
for the former reason the instantiation neither needs mount object and
the path where files for testing will be created nor it needs to run the
method that creates files for testing rw permissions. When using
this class for latter the case is the exact opposite.
Create 2 separate classes for each of these purpose and class that
inherits both of these classes so that instantiating the class becomes
as simple as it can be.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Improvement #1:
CapTester.write_test_files() not only creates the test file but also
does the following for every mount object it receives in parameters -
* carefully produces the path for the test file as per parameters
received
* generates the unique data for each test file on a CephFS mount
* creates a data structure -- list of lists -- that holds all this
information along with mount object itself for each mount object so
that tests can be conducted at a later point
Untangle this mess of code by splitting this method into 3 separate
methods -
1. To produce the path for test file (as per user's need).
2. To generate the data that will be written into the test file.
3. To actually create the test file on CephFS.
Improvement #2:
Remove the internal data structure used for testing -- self.test_set --
and use separate class attributes to store all the data required for
testing instead of a tuple. This serves two purpose -
One, it makes it easy to manipulate all this data from helper methods
and during debugging session, especially while using a PDB session.
And two, make it impossible to have multiple mounts/multiple "test sets"
within same CapTester instance for the sake of simplicity. Users can
instead create two instances of CapTester instances if needed.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
test_mutlifs_auth.TestMDSCaps._create_client() not only creates a client
but also generate caps strings for the client as per the parameter this
method receives and and then writes the keyring to all remote machines.
This creates confusion when reading code on test methods in TestMDSCaps.
Let's re-arrange this code such that this confusion is avoided.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Add methods that will accept read/write permissions, CephFS names and
CephFS mount point and in return will generate string form of MON, OSD
and MDS caps exactly as it is reported in Ceph keyrings.
Replace similar code in test_multifs_auth.py with calls to these helper
methods.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Remove setup_test_env() because removing this methods removes an extra
layer of abstraction which makes tests more readable. Rename
_create_client_and_keyring_file() to just _create_client() and reverse
the order of parameters in remount_with_new_client() and set default
value of cephfs_mntpt to '/'.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
caps_helper.py since caps_helper.py has been heavily modified in
previous commits.
setup_fs_contents() is being deleted since it is not used anymore.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Stop importing CommandFailedError from teuthology.orchestra.run, it is
actually defined in teuthology.exception.
Fixes: https://tracker.ceph.com/issues/51226
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Since teuthology.orchestra.remote.mktemp() can write a temporary file
and not just create it, create_keyring_file() is now redundant.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Example:
2020-10-30T03:37:33.752 INFO:tasks.cephfs_test_runner:======================================================================
2020-10-30T03:37:33.752 INFO:tasks.cephfs_test_runner:FAIL: test_mount_mon_and_osd_caps_present_mds_caps_absent (tasks.cephfs.test_multifs_auth.TestClientsWithoutAuth)
2020-10-30T03:37:33.752 INFO:tasks.cephfs_test_runner:----------------------------------------------------------------------
2020-10-30T03:37:33.753 INFO:tasks.cephfs_test_runner:Traceback (most recent call last):
2020-10-30T03:37:33.753 INFO:tasks.cephfs_test_runner: File "/home/teuthworker/src/github.com_batrick_ceph_cephfs-qa-reorg/qa/tasks/cephfs/test_multifs_auth.py", line 311, in test_mount_mon_and_osd_caps_present_mds_caps_absent
2020-10-30T03:37:33.753 INFO:tasks.cephfs_test_runner: self.check_that_mount_failed_for_right_reason(retval[2])
2020-10-30T03:37:33.753 INFO:tasks.cephfs_test_runner: File "/home/teuthworker/src/github.com_batrick_ceph_cephfs-qa-reorg/qa/tasks/cephfs/test_multifs_auth.py", line 269, in check_that_mount_failed_for_right_reason
2020-10-30T03:37:33.753 INFO:tasks.cephfs_test_runner: raise AssertionError('can\'t find expected set of words in the '
2020-10-30T03:37:33.754 INFO:tasks.cephfs_test_runner:AssertionError: can't find expected set of words in the stderr
2020-10-30T03:37:33.754 INFO:tasks.cephfs_test_runner:self.errmsgs - ('permission denied', 'no mds server is up or the cluster is laggy', 'no such file or directory')
2020-10-30T03:37:33.754 INFO:tasks.cephfs_test_runner:stderr - mount error 5 = input/output error
From: /ceph/teuthology-archive/pdonnell-2020-10-30_02:26:51-fs-master-distro-basic-smithi/5573109/teuthology.log
Fixes: https://tracker.ceph.com/issues/23718
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
Add testsuite for testing authorization on Ceph cluster with multiple
file systems and enable it to be executable with Teuthology framework.
Also add helper methods required to setup the test environment for
multi-FS tests.
Signed-off-by: Rishabh Dave <ridave@redhat.com>