Skip to content

Commit a21870a

Browse files
authored
Merge pull request ceph#55725 from neesingh-rh/wip-63699
qa: fixing tests in test_cephfs_shell.TestShellOpts Reviewed-by: Venky Shankar <[email protected]>
2 parents 538e3bd + 198d177 commit a21870a

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

qa/tasks/cephfs/test_cephfs_shell.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,11 +1108,13 @@ def setUp(self):
11081108
# output of following command -
11091109
# editor - was: 'vim'
11101110
# now: '?'
1111-
# editor: '?'
1111+
# Name Value Description
1112+
# ====================================================================================================
1113+
# editor ? Program used by 'edit'
11121114
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()
1115+
'set editor ?, set editor').split('\n')[4]
1116+
self.editor_val = self.editor_val.split()[1].strip(). \
1117+
replace("'", "", 2)
11161118

11171119
def write_tempconf(self, confcontents):
11181120
self.tempconfpath = self.mount_a.client_remote.mktemp(
@@ -1125,43 +1127,51 @@ def test_reading_conf(self):
11251127

11261128
# output of following command -
11271129
# CephFS:~/>>> set editor
1128-
# editor: 'vim'
1130+
# Name Value Description
1131+
# ====================================================================================================
1132+
# editor ??? Program used by 'edit'
11291133
final_editor_val = self.get_cephfs_shell_cmd_output(
11301134
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)
1135+
final_editor_val = final_editor_val.split('\n')[2]
1136+
final_editor_val = final_editor_val.split()[1].strip(). \
1137+
replace("'", "", 2)
11331138

11341139
self.assertNotEqual(self.editor_val, final_editor_val)
11351140

11361141
def test_reading_conf_with_dup_opt(self):
11371142
"""
1138-
Read conf without duplicate sections/options.
1143+
Read conf with duplicate sections/options.
11391144
"""
11401145
self.write_tempconf("[cephfs-shell]\neditor = ???\neditor = " +
11411146
self.editor_val)
11421147

11431148
# output of following command -
11441149
# CephFS:~/>>> set editor
1145-
# editor: 'vim'
1150+
# Name Value Description
1151+
# ====================================================================================================
1152+
# editor ? Program used by 'edit'
11461153
final_editor_val = self.get_cephfs_shell_cmd_output(
11471154
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)
1155+
final_editor_val = final_editor_val.split('\n')[2]
1156+
final_editor_val = final_editor_val.split()[1].strip(). \
1157+
replace("'", "", 2)
11501158

11511159
self.assertEqual(self.editor_val, final_editor_val)
11521160

11531161
def test_setting_opt_after_reading_conf(self):
11541162
self.write_tempconf("[cephfs-shell]\neditor = ???")
11551163

11561164
# output of following command -
1157-
# editor - was: vim
1158-
# now: vim
1159-
# editor: vim
1165+
# editor - was: ???
1166+
# now: ?
1167+
# Name Value Description
1168+
# ====================================================================================================
1169+
# editor ? Program used by 'edit'
11601170
final_editor_val = self.get_cephfs_shell_cmd_output(
11611171
cmd='set editor %s, set editor' % self.editor_val,
11621172
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)
1173+
final_editor_val = final_editor_val.split('\n')[4]
1174+
final_editor_val = final_editor_val.split()[1].strip(). \
1175+
replace("'", "", 2)
11661176

11671177
self.assertEqual(self.editor_val, final_editor_val)

0 commit comments

Comments
 (0)