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>
"run_shell" adds 'sudo' which runs afoul of new security protections on
Ubuntu 20.04.
Fixes: https://tracker.ceph.com/issues/51417
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
And set colors to False and debug to True in this conf file.
stdout captured by Python code in this testsuite can contain the colour
codes along with the expected string output. Setting colors to False in
cephfs-shell.conf should fix this.
Setting debug to False should help with analyzing test failures since
it enables printing messages that helps debugging (stacktrace for
cephfs-shell code, for example).
Signed-off-by: Rishabh Dave <ridave@redhat.com>
The reason behind adding and removing this test in different commits of
the same PR is that test_every_shell_cmd_at_invocation is to keep it in
case it's needed later. It reruns all tests in this testsuite by issuing
all cephfs shell commands as arguments to cephfs-shell instead of
issuing them on stdin.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Code for each command has a return value set yet cephfs-shell itself
doesn't exit with proper return value. This makes cephfs-shell quit with
zero return value all the time.
Also, many tests execute cephfs-shell commands expecting the command to
fail but without expecting the method issuing the command to fail. Fix
these test accordingly by adding a new method (negtest_cephfs_shell_cmd)
that expects the command to fail and allows verifying return value and
error messages.
Fixes: https://tracker.ceph.com/issues/44113
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Re-arrange in the order of their usefulness and use keyword arguments
instead of positional arguments to reduce chances of errors, especially
since test_every_cephfs_shell_cmd_at_invocation overrides these methods.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Test passing each CephFS shell command at invocation of shell. The test
replaces run_cephfs_shell_cmd (and other related methods) by it's own
version of the same method that runs each shell command as
"cephfs-shell -c ceph.conf shellcmd" instead of
"cephfs-shell -c ceph.conf -- shellcmd" and then run each
test_cephfs_shell.py.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Code in qa/ uses both StringIO and BytesIO. Let's use StringIO
exclusively (unless necessary) for uniformity. The reason for using
StringIO over BytesIO is that tests mostly need stdout as string than
as bytes and StringIO is used more frequently used in qa/ code at this
point.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
cephfs-shell options should reside in cephfs-shell.conf and not in
ceph.conf. Please note, unlike before, -c option of cephfs-shell must
take path to cephfs-shell.conf instead of path to ceph.conf.
This commit also updates the docs and the tests for cephfs-shell accordingly
and renames the variable config_path in cephfs-shell to shell_conf_path so
that it's easy to distinguish.
Fixes: https://tracker.ceph.com/issues/44127
Signed-off-by: Rishabh Dave <ridave@redhat.com>
The refactor intends to simplify the test and make it more readable,
It also changes how this test creates directory -- tempfile.mkdtemp is
used instead of coreutils mkdir to avoid bug reported here -
https://tracker.ceph.com/issues/43567.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Using assert causes the tests to fail on teuthology due to this test being run
separately from the ceph cluster. Instead use stat for testing.
Signed-off-by: Varsha Rao <varao@redhat.com>
This patch makes following modifications quota test:
- Add additional condtion to confirm Command Failure Error due to exceeding set
quota values.
- Rename function valid to set_and_get_quota_vals.
- Use run_cephfs_shell_cmd instead of get_cephfs_shell_cmd_output.
Signed-off-by: Varsha Rao <varao@redhat.com>
Use of mount_a.run_shell() to create directory, requires Sudo access and
cephfs-shell should be run without sudo access. Instead use cephfs-shell mkdir
command to create directory.
Signed-off-by: Varsha Rao <varao@redhat.com>
ln command needs superuser privileges, oddly that test had run
successfully before.
Fixes: https://tracker.ceph.com/issues/43250
Signed-off-by: Rishabh Dave <ridave@redhat.com>
There were a couple of problems found by flake8 in the qa/
directory (most of them fixed now). Enabling flake8 during the usual
check runs hopefully avoids adding new issues in the future.
Signed-off-by: Thomas Bechtold <tbechtold@suse.com>
The traceback would screw up the equality checks.
Also, use unittest asserts so we can easily see the assert values.
Fixes: https://tracker.ceph.com/issues/43247
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
Adds tests that checks -
* reading conf option
* reading conf option after setting it twice
* reading conf option after setting it after a reset
Signed-off-by: Rishabh Dave <ridave@redhat.com>
In the test
test_cephfs_shell.TestMisc.test_issue_cephfs_shell_cmd_at_invocation,
don't set the shell option with in the command to be tested since
CephFS shell can now read it's value from ceph.conf.
Also, add methods to set config options for vstart as well teuthology
testing.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
Since teuthology initializes stderr to None by default, absence of this
breaks the tests accessing stderr of commands executed within the test
when the execution is using teuthology.
Fixes: https://tracker.ceph.com/issues/42806
Signed-off-by: Rishabh Dave <ridave@redhat.com>
The default behaviour by cmd2 for help command with no argument is to
print all possible commands and return 1. This leads to a failure even
when test is supposed to pass.
Fixes: https://tracker.ceph.com/issues/42101
Signed-off-by: Rishabh Dave <ridave@redhat.com>