]> 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:29:30 +0000 (21:29 +0100)
committerKefu Chai <kchai@redhat.com>
Tue, 2 Jun 2020 02:32:22 +0000 (10:32 +0800)
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
(cherry picked from commit 99e9e82d646a9db1773ca97da7460dbfb5a0b415)

qa/tasks/watch_notify_same_primary.py

index b462e5e4d76ed7e06f0571aa204e91fbd7475c1f..3cb7eeb704abf167504e258b84d74dc6a3ac624e 100644 (file)
@@ -2,7 +2,7 @@
 """
 watch_notify_same_primary task
 """
-from cStringIO import StringIO
+from io import BytesIO
 import contextlib
 import logging
 
@@ -66,8 +66,8 @@ def task(ctx, config):
                 "watch",
                 obj(n)],
             stdin=run.PIPE,
-            stdout=StringIO(),
-            stderr=StringIO(),
+            stdout=BytesIO(),
+            stderr=BytesIO(),
             wait=False)
         return proc
 
@@ -79,14 +79,8 @@ def task(ctx, config):
     for i in range(num):
         with safe_while() as proceed:
             while proceed():
-                proc = remote.run(
-                    args = [
-                        "rados",
-                        "-p", pool,
-                        "listwatchers",
-                        obj(i)],
-                    stdout=StringIO())
-                lines = proc.stdout.getvalue()
+                lines = remote.sh(
+                    ["rados", "-p", pool, "listwatchers", obj(i)])
                 num_watchers = lines.count('watcher=')
                 log.info('i see %d watchers for %s', num_watchers, obj(i))
                 if num_watchers >= 1: