]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: get rid of cStringIO for py3
authorKyr Shatskyy <kyrylo.shatskyy@suse.com>
Fri, 21 Feb 2020 20:36:48 +0000 (21:36 +0100)
committerKefu Chai <kchai@redhat.com>
Wed, 4 Mar 2020 05:09:17 +0000 (13:09 +0800)
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
qa/tasks/osd_failsafe_enospc.py

index 8d89919035dcea4cfc89fa24082a0e81c6de3b73..6aec322ea85b251648b7fd3efd55967de6b14772 100644 (file)
@@ -1,8 +1,9 @@
 """
 Handle osdfailsafe configuration settings (nearfull ratio and full ratio)
 """
-from cStringIO import StringIO
+from io import BytesIO
 import logging
+import six
 import time
 
 from teuthology.orchestra import run
@@ -64,7 +65,7 @@ def task(ctx, config):
                  'ceph', '-w'
              ],
              stdin=run.PIPE,
-             stdout=StringIO(),
+             stdout=BytesIO(),
              wait=False,
         )
 
@@ -74,7 +75,7 @@ def task(ctx, config):
     proc.stdin.close() # causes daemon-helper send SIGKILL to ceph -w
     proc.wait()
 
-    lines = proc.stdout.getvalue().split('\n')
+    lines = six.ensure_str(proc.stdout.getvalue()).split('\n')
 
     count = len(filter(lambda line: '[WRN] OSD near full' in line, lines))
     assert count == 2, 'Incorrect number of warning messages expected 2 got %d' % count
@@ -92,7 +93,7 @@ def task(ctx, config):
                  'ceph', '-w'
              ],
              stdin=run.PIPE,
-             stdout=StringIO(),
+             stdout=BytesIO(),
              wait=False,
         )
 
@@ -102,7 +103,7 @@ def task(ctx, config):
     proc.stdin.close() # causes daemon-helper send SIGKILL to ceph -w
     proc.wait()
 
-    lines = proc.stdout.getvalue().split('\n')
+    lines = six.ensure_str(proc.stdout.getvalue()).split('\n')
 
     count = len(filter(lambda line: '[ERR] OSD full dropping all updates' in line, lines))
     assert count == 2, 'Incorrect number of error messages expected 2 got %d' % count
@@ -134,7 +135,7 @@ def task(ctx, config):
                  'ceph', '-w'
              ],
              stdin=run.PIPE,
-             stdout=StringIO(),
+             stdout=BytesIO(),
              wait=False,
         )
 
@@ -142,7 +143,7 @@ def task(ctx, config):
     proc.stdin.close() # causes daemon-helper send SIGKILL to ceph -w
     proc.wait()
 
-    lines = proc.stdout.getvalue().split('\n')
+    lines = six.ensure_str(proc.stdout.getvalue()).split('\n')
 
     count = len(filter(lambda line: '[WRN] OSD near full' in line, lines))
     assert count == 1 or count == 2, 'Incorrect number of warning messages expected 1 or 2 got %d' % count
@@ -163,7 +164,7 @@ def task(ctx, config):
                  'ceph', '-w'
              ],
              stdin=run.PIPE,
-             stdout=StringIO(),
+             stdout=BytesIO(),
              wait=False,
         )
 
@@ -173,7 +174,7 @@ def task(ctx, config):
     proc.stdin.close() # causes daemon-helper send SIGKILL to ceph -w
     proc.wait()
 
-    lines = proc.stdout.getvalue().split('\n')
+    lines = six.ensure_str(proc.stdout.getvalue()).split('\n')
 
     count = len(filter(lambda line: '[WRN] OSD near full' in line, lines))
     assert count == 0, 'Incorrect number of warning messages expected 0 got %d' % count
@@ -194,7 +195,7 @@ def task(ctx, config):
                  'ceph', '-w'
              ],
              stdin=run.PIPE,
-             stdout=StringIO(),
+             stdout=BytesIO(),
              wait=False,
         )
 
@@ -202,7 +203,7 @@ def task(ctx, config):
     proc.stdin.close() # causes daemon-helper send SIGKILL to ceph -w
     proc.wait()
 
-    lines = proc.stdout.getvalue().split('\n')
+    lines = six.ensure_str(proc.stdout.getvalue()).split('\n')
 
     count = len(filter(lambda line: '[WRN] OSD near full' in line, lines))
     assert count == 0, 'Incorrect number of warning messages expected 0 got %d' % count