You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2018/02/26 21:51:19 UTC

cassandra-dtest git commit: Dont call decode

Repository: cassandra-dtest
Updated Branches:
  refs/heads/master 3d0d0f45f -> 7fd89e146


Dont call decode

Patch by marcuse; reviewed by Michael Shuler for CASSANDRA-14241


Project: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/commit/7fd89e14
Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/7fd89e14
Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/7fd89e14

Branch: refs/heads/master
Commit: 7fd89e14653ab196c5cb5cddf862ae060608056a
Parents: 3d0d0f4
Author: Marcus Eriksson <ma...@apache.org>
Authored: Fri Feb 23 08:32:42 2018 -0800
Committer: Marcus Eriksson <ma...@apache.org>
Committed: Mon Feb 26 13:50:12 2018 -0800

----------------------------------------------------------------------
 bootstrap_test.py                       |  2 +-
 meta_tests/assertion_test.py            |  2 +-
 offline_tools_test.py                   | 20 ++++++++++----------
 repair_tests/incremental_repair_test.py | 12 ++++++------
 tools/assertions.py                     |  2 +-
 5 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/7fd89e14/bootstrap_test.py
----------------------------------------------------------------------
diff --git a/bootstrap_test.py b/bootstrap_test.py
index 22dddcd..661aef9 100644
--- a/bootstrap_test.py
+++ b/bootstrap_test.py
@@ -335,7 +335,7 @@ class TestBootstrap(Tester):
         stdout, stderr, _ = node3.stress(['read', 'n=1k', 'no-warmup', '-schema', 'replication(factor=2)', '-rate', 'threads=8'])
 
         if stdout is not None:
-            assert "FAILURE" not in stdout.decode("utf-8")
+            assert "FAILURE" not in stdout
 
     @since('2.2')
     def test_bootstrap_with_reset_bootstrap_state(self):

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/7fd89e14/meta_tests/assertion_test.py
----------------------------------------------------------------------
diff --git a/meta_tests/assertion_test.py b/meta_tests/assertion_test.py
index 2c3fe09..f5d8b51 100644
--- a/meta_tests/assertion_test.py
+++ b/meta_tests/assertion_test.py
@@ -8,7 +8,7 @@ from tools.assertions import (assert_all, assert_almost_equal, assert_exception,
                               assert_invalid, assert_length_equal, assert_none,
                               assert_one, assert_row_count, assert_stderr_clean,
                               assert_unauthorized, assert_unavailable)
-
+import pytest
 
 class TestAssertStderrClean(TestCase):
 

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/7fd89e14/offline_tools_test.py
----------------------------------------------------------------------
diff --git a/offline_tools_test.py b/offline_tools_test.py
index 9e3dc73..fce1f5f 100644
--- a/offline_tools_test.py
+++ b/offline_tools_test.py
@@ -54,7 +54,7 @@ class TestOfflineTools(Tester):
 
         output, error, rc = node1.run_sstablelevelreset("keyspace1", "standard1")
         self._check_stderr_error(error)
-        assert re.search("Found no sstables, did you give the correct keyspace", output.decode("utf-8"))
+        assert re.search("Found no sstables, did you give the correct keyspace", output)
         assert rc == 0, str(rc)
 
         # test by writing small amount of data and flushing (all sstables should be level 0)
@@ -67,8 +67,8 @@ class TestOfflineTools(Tester):
         cluster.stop(gently=False)
 
         output, error, rc = node1.run_sstablelevelreset("keyspace1", "standard1")
-        self._check_stderr_error(error.decode("utf-8"))
-        assert re.search("since it is already on level 0", output.decode("utf-8"))
+        self._check_stderr_error(error)
+        assert re.search("since it is already on level 0", output)
         assert rc == 0, str(rc)
 
         # test by loading large amount data so we have multiple levels and checking all levels are 0 at end
@@ -82,7 +82,7 @@ class TestOfflineTools(Tester):
         initial_levels = self.get_levels(node1.run_sstablemetadata(keyspace="keyspace1", column_families=["standard1"]))
         _, error, rc = node1.run_sstablelevelreset("keyspace1", "standard1")
         final_levels = self.get_levels(node1.run_sstablemetadata(keyspace="keyspace1", column_families=["standard1"]))
-        self._check_stderr_error(error.decode("utf-8"))
+        self._check_stderr_error(error)
         assert rc == 0, str(rc)
 
         logger.debug(initial_levels)
@@ -96,7 +96,7 @@ class TestOfflineTools(Tester):
 
     def get_levels(self, data):
         (out, err, rc) = data
-        return list(map(int, re.findall("SSTable Level: ([0-9])", out.decode("utf-8"))))
+        return list(map(int, re.findall("SSTable Level: ([0-9])", out)))
 
     def wait_for_compactions(self, node):
         pattern = re.compile("pending tasks: 0")
@@ -139,7 +139,7 @@ class TestOfflineTools(Tester):
         try:
             output, error, _ = node1.run_sstableofflinerelevel("keyspace1", "standard1")
         except ToolError as e:
-            assert re.search("No sstables to relevel for keyspace1.standard1", e.stdout.decode("utf-8"))
+            assert re.search("No sstables to relevel for keyspace1.standard1", e.stdout)
             assert e.exit_status == 1, str(e.exit_status)
 
         # test by flushing (sstable should be level 0)
@@ -157,7 +157,7 @@ class TestOfflineTools(Tester):
         cluster.stop()
 
         output, _, rc = node1.run_sstableofflinerelevel("keyspace1", "standard1")
-        assert re.search("L0=1", output.decode("utf-8"))
+        assert re.search("L0=1", output)
         assert rc == 0, str(rc)
 
         cluster.start(wait_for_binary_proto=True)
@@ -254,7 +254,7 @@ class TestOfflineTools(Tester):
         # map over each line of out and replace Java-normalized paths with Python equivalents.
         outlines = [re.sub("(?<=path=').*(?=')",
                                            lambda match: os.path.normcase(match.group(0)),
-                                           line) for line in out.decode("utf-8").splitlines()]
+                                           line) for line in out.splitlines()]
 
         # check output is correct for each sstable
         sstables = self._get_final_sstables(node1, "keyspace1", "standard1")
@@ -310,7 +310,7 @@ class TestOfflineTools(Tester):
         session.execute("delete from ks.cf where key = 3")
         node1.flush()
         out, error, _ = node1.run_sstableexpiredblockers(keyspace="ks", column_family="cf")
-        assert "blocks 2 expired sstables from getting dropped" in out.decode("utf-8")
+        assert "blocks 2 expired sstables from getting dropped" in out
 
     # 4.0 removes back compatibility with pre-3.0 versions, so testing upgradesstables for
     # paths from those versions to 4.0 is invalid (and can only fail). There isn't currently
@@ -467,7 +467,7 @@ class TestOfflineTools(Tester):
             env = common.make_cassandra_env(node.get_install_cassandra_root(), node.get_node_cassandra_root())
             p = subprocess.Popen(args, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
             (stdout, stderr) = p.communicate()
-            tmpsstables = list(map(os.path.normcase, stdout.decode("utf-8").splitlines()))
+            tmpsstables = list(map(os.path.normcase, stdout.splitlines()))
 
             ret = list(set(allsstables) - set(tmpsstables))
         else:

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/7fd89e14/repair_tests/incremental_repair_test.py
----------------------------------------------------------------------
diff --git a/repair_tests/incremental_repair_test.py b/repair_tests/incremental_repair_test.py
index 4791e9a..37ee64a 100644
--- a/repair_tests/incremental_repair_test.py
+++ b/repair_tests/incremental_repair_test.py
@@ -50,7 +50,7 @@ class TestIncRepair(Tester):
         out = node.run_sstablemetadata(keyspace=keyspace).stdout
 
         def matches(pattern):
-            return filter(None, [pattern.match(l) for l in out.decode("utf-8").split('\n')])
+            return filter(None, [pattern.match(l) for l in out.split('\n')])
         names = [m.group(1) for m in matches(_sstable_name)]
         repaired_times = [int(m.group(1)) for m in matches(_repaired_at)]
 
@@ -360,7 +360,7 @@ class TestIncRepair(Tester):
                 node.nodetool('compact keyspace1 standard1')
 
         for out in (node.run_sstablemetadata(keyspace='keyspace1').stdout for node in self.cluster.nodelist()):
-            assert 'Repaired at: 0' not in out.decode("utf-8")
+            assert 'Repaired at: 0' not in out
 
     def test_multiple_repair(self):
         """
@@ -468,8 +468,8 @@ class TestIncRepair(Tester):
         node2.run_sstablerepairedset(keyspace='keyspace1')
         node2.start(wait_for_binary_proto=True)
 
-        initialOut1 = node1.run_sstablemetadata(keyspace='keyspace1').stdout.decode("utf-8")
-        initialOut2 = node2.run_sstablemetadata(keyspace='keyspace1').stdout.decode("utf-8")
+        initialOut1 = node1.run_sstablemetadata(keyspace='keyspace1').stdout
+        initialOut2 = node2.run_sstablemetadata(keyspace='keyspace1').stdout
 
         matches = findall('(?<=Repaired at:).*', '\n'.join([initialOut1, initialOut2]))
         logger.debug("Repair timestamps are: {}".format(matches))
@@ -500,10 +500,10 @@ class TestIncRepair(Tester):
 
         finalOut1 = node1.run_sstablemetadata(keyspace='keyspace1').stdout
         if not isinstance(finalOut1, str):
-            finalOut1 = finalOut1.decode("utf-8")
+            finalOut1 = finalOut1
         finalOut2 = node2.run_sstablemetadata(keyspace='keyspace1').stdout
         if not isinstance(finalOut2, str):
-            finalOut2 = finalOut2.decode("utf-8")
+            finalOut2 = finalOut2
 
         matches = findall('(?<=Repaired at:).*', '\n'.join([finalOut1, finalOut2]))
 

http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/7fd89e14/tools/assertions.py
----------------------------------------------------------------------
diff --git a/tools/assertions.py b/tools/assertions.py
index 864a4df..a7552a0 100644
--- a/tools/assertions.py
+++ b/tools/assertions.py
@@ -285,7 +285,7 @@ def assert_stderr_clean(err, acceptable_errors=None):
                              "Failed to connect over JMX; not collecting these stats"]
 
     regex_str = "^({}|\s*|\n)*$".format("|".join(acceptable_errors))
-    err_str = err.decode("utf-8").strip()
+    err_str = err.strip()
     # empty string, as good as we can get for a clean stderr output!
     if not err_str:
         return


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org