Skip to content

Commit 118ac67

Browse files
author
neeraj pratap singh
committed
cephfs-shell: fixing TestShellOpts in test_cephfs_shell.py
The issue arose due to the change in the output format of the command `set editor`. Earlier the output format was like: `editor: 'vim' ` which has been changed to: ```Name Value Description ==================================================================================================== editor vim Program used by 'edit' ``` Due to which fetching the list using indexes was `out of range`. Introduced by: python-cmd2/cmd2@fd38e70 Fixes: https://tracker.ceph.com/issues/63699 Signed-off-by: Neeraj Pratap Singh <[email protected]>
1 parent 49d060c commit 118ac67

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

qa/tasks/cephfs/test_cephfs_shell.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,9 +1110,9 @@ def setUp(self):
11101110
# now: '?'
11111111
# editor: '?'
11121112
self.editor_val = self.get_cephfs_shell_cmd_output(
1113-
'set editor ?, set editor').split('\n')[2]
1114-
self.editor_val = self.editor_val.split(':')[1]. \
1115-
replace("'", "", 2).strip()
1113+
'set editor ?, set editor').split('\n')[4]
1114+
self.editor_val = self.editor_val.split()[1].strip(). \
1115+
replace("'", "", 2)
11161116

11171117
def write_tempconf(self, confcontents):
11181118
self.tempconfpath = self.mount_a.client_remote.mktemp(
@@ -1128,8 +1128,9 @@ def test_reading_conf(self):
11281128
# editor: 'vim'
11291129
final_editor_val = self.get_cephfs_shell_cmd_output(
11301130
cmd='set editor', shell_conf_path=self.tempconfpath)
1131-
final_editor_val = final_editor_val.split(': ')[1]
1132-
final_editor_val = final_editor_val.replace("'", "", 2)
1131+
final_editor_val = final_editor_val.split('\n')[2]
1132+
final_editor_val = final_editor_val.split()[1].strip(). \
1133+
replace("'", "", 2)
11331134

11341135
self.assertNotEqual(self.editor_val, final_editor_val)
11351136

@@ -1145,8 +1146,9 @@ def test_reading_conf_with_dup_opt(self):
11451146
# editor: 'vim'
11461147
final_editor_val = self.get_cephfs_shell_cmd_output(
11471148
cmd='set editor', shell_conf_path=self.tempconfpath)
1148-
final_editor_val = final_editor_val.split(': ')[1]
1149-
final_editor_val = final_editor_val.replace("'", "", 2)
1149+
final_editor_val = final_editor_val.split('\n')[2]
1150+
final_editor_val = final_editor_val.split()[1].strip(). \
1151+
replace("'", "", 2)
11501152

11511153
self.assertEqual(self.editor_val, final_editor_val)
11521154

@@ -1160,8 +1162,8 @@ def test_setting_opt_after_reading_conf(self):
11601162
final_editor_val = self.get_cephfs_shell_cmd_output(
11611163
cmd='set editor %s, set editor' % self.editor_val,
11621164
shell_conf_path=self.tempconfpath)
1163-
final_editor_val = final_editor_val.split('\n')[2]
1164-
final_editor_val = final_editor_val.split(': ')[1]
1165-
final_editor_val = final_editor_val.replace("'", "", 2)
1165+
final_editor_val = final_editor_val.split('\n')[4]
1166+
final_editor_val = final_editor_val.split()[1].strip(). \
1167+
replace("'", "", 2)
11661168

11671169
self.assertEqual(self.editor_val, final_editor_val)

0 commit comments

Comments
 (0)