From 99e9e82d646a9db1773ca97da7460dbfb5a0b415 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Fri, 21 Feb 2020 21:29:30 +0100 Subject: [PATCH] qa/tasks: get rid of cStringIO for py3 Signed-off-by: Kyr Shatskyy --- qa/tasks/watch_notify_same_primary.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/qa/tasks/watch_notify_same_primary.py b/qa/tasks/watch_notify_same_primary.py index 56bf98425f0..7160979119b 100644 --- a/qa/tasks/watch_notify_same_primary.py +++ b/qa/tasks/watch_notify_same_primary.py @@ -2,7 +2,7 @@ """ watch_notify_same_primary task """ -from cStringIO import StringIO +from io import BytesIO import contextlib import logging @@ -68,8 +68,8 @@ def task(ctx, config): "watch", obj(n)], stdin=run.PIPE, - stdout=StringIO(), - stderr=StringIO(), + stdout=BytesIO(), + stderr=BytesIO(), wait=False) return proc @@ -81,14 +81,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: -- 2.39.5