Repository: cassandra-dtest Updated Branches: refs/heads/master 2415aa0ef -> 77be87ecf
Migrate to pytest 3.6 and fix Python 3 warnings patch by Stefan Podkowinski; reviewed by Marcus Eriksson for CASSANDRA-14713 Project: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/commit/77be87ec Tree: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/tree/77be87ec Diff: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/diff/77be87ec Branch: refs/heads/master Commit: 77be87ecf51aa6a3cb61c43f3d41e33f5344fddd Parents: 2415aa0 Author: Stefan Podkowinski <stefan.podkowin...@1und1.de> Authored: Fri Sep 21 10:37:29 2018 +0200 Committer: Stefan Podkowinski <stefan.podkowin...@1und1.de> Committed: Wed Oct 10 10:23:34 2018 +0200 ---------------------------------------------------------------------- auth_test.py | 32 ++++++------ batch_test.py | 4 +- commitlog_test.py | 6 +-- concurrent_schema_changes_test.py | 2 +- conftest.py | 27 +++++------ cqlsh_tests/cqlsh_tests.py | 2 +- dtest.py | 4 +- internode_messaging_test.py | 2 +- jmx_test.py | 2 +- materialized_views_test.py | 14 ++---- repair_tests/deprecated_repair_test.py | 8 +-- repair_tests/repair_test.py | 22 ++++----- replication_test.py | 8 +-- requirements.txt | 2 +- run_dtests.py | 4 +- secondary_indexes_test.py | 2 +- thrift_test.py | 8 +-- tools/assertions.py | 2 +- tools/datahelp.py | 2 +- tools/jmxutils.py | 54 ++++++++++----------- topology_test.py | 2 +- transient_replication_test.py | 6 +-- upgrade_tests/regression_test.py | 2 +- upgrade_tests/upgrade_schema_agreement_test.py | 2 +- 24 files changed, 107 insertions(+), 112 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/auth_test.py ---------------------------------------------------------------------- diff --git a/auth_test.py b/auth_test.py index f2cd844..7c275e0 100644 --- a/auth_test.py +++ b/auth_test.py @@ -123,7 +123,7 @@ class TestAuth(Tester): cassandra.execute("CREATE USER jackob WITH PASSWORD '12345' NOSUPERUSER") jackob = self.get_session(user='jackob', password='12345') - assert_unauthorized(jackob, "CREATE USER james WITH PASSWORD '54321' NOSUPERUSER", 'Only superusers are allowed to perform CREATE (\[ROLE\|USER\]|USER) queries', ) + assert_unauthorized(jackob, "CREATE USER james WITH PASSWORD '54321' NOSUPERUSER", 'Only superusers are allowed to perform CREATE (\\[ROLE\\|USER\\]|USER) queries', ) @since('1.2', max_version='2.1.x') def test_password_authenticator_create_user_requires_password(self): @@ -256,7 +256,7 @@ class TestAuth(Tester): assert 3 == len(rows) cathy = self.get_session(user='cathy', password='12345') - assert_unauthorized(cathy, 'DROP USER dave', 'Only superusers are allowed to perform DROP (\[ROLE\|USER\]|USER) queries') + assert_unauthorized(cathy, 'DROP USER dave', 'Only superusers are allowed to perform DROP (\\[ROLE\\|USER\\]|USER) queries') rows = list(cassandra.execute("LIST USERS")) assert 3 == len(rows) @@ -2202,7 +2202,7 @@ class TestAuthRoles(Tester): self.superuser.execute("GRANT EXECUTE ON FUNCTION ks.func_one(int) TO mike") as_mike.execute(select_one) assert_unauthorized(as_mike, select_two, - "User mike has no EXECUTE permission on <function ks.func_two\(int\)> or any of its parents") + r"User mike has no EXECUTE permission on <function ks.func_two\(int\)> or any of its parents") # granting EXECUTE on all of the parent keyspace's should enable mike to use both functions self.superuser.execute("GRANT EXECUTE ON ALL FUNCTIONS IN KEYSPACE ks TO mike") as_mike.execute(select_one) @@ -2211,7 +2211,7 @@ class TestAuthRoles(Tester): self.superuser.execute("REVOKE EXECUTE ON ALL FUNCTIONS IN KEYSPACE ks FROM mike") as_mike.execute(select_one) assert_unauthorized(as_mike, select_two, - "User mike has no EXECUTE permission on <function ks.func_two\(int\)> or any of its parents") + r"User mike has no EXECUTE permission on <function ks.func_two\(int\)> or any of its parents") # now check that EXECUTE on ALL FUNCTIONS works in the same way self.superuser.execute("GRANT EXECUTE ON ALL FUNCTIONS TO mike") as_mike.execute(select_one) @@ -2219,7 +2219,7 @@ class TestAuthRoles(Tester): self.superuser.execute("REVOKE EXECUTE ON ALL FUNCTIONS FROM mike") as_mike.execute(select_one) assert_unauthorized(as_mike, select_two, - "User mike has no EXECUTE permission on <function ks.func_two\(int\)> or any of its parents") + r"User mike has no EXECUTE permission on <function ks.func_two\(int\)> or any of its parents") # finally, check that revoking function level permissions doesn't affect root/keyspace level perms self.superuser.execute("GRANT EXECUTE ON ALL FUNCTIONS IN KEYSPACE ks TO mike") self.superuser.execute("REVOKE EXECUTE ON FUNCTION ks.func_one(int) FROM mike") @@ -2253,7 +2253,7 @@ class TestAuthRoles(Tester): # can't replace an existing function without ALTER permission on the parent ks cql = "CREATE OR REPLACE FUNCTION ks.plus_one( input int ) CALLED ON NULL INPUT RETURNS int LANGUAGE javascript as '1 + input'" assert_unauthorized(as_mike, cql, - "User mike has no ALTER permission on <function ks.plus_one\(int\)> or any of its parents") + r"User mike has no ALTER permission on <function ks.plus_one\(int\)> or any of its parents") self.superuser.execute("GRANT ALTER ON FUNCTION ks.plus_one(int) TO mike") as_mike.execute(cql) @@ -2262,21 +2262,21 @@ class TestAuthRoles(Tester): self.superuser.execute("CREATE ROLE role1") cql = "GRANT EXECUTE ON FUNCTION ks.plus_one(int) TO role1" assert_unauthorized(as_mike, cql, - "User mike has no AUTHORIZE permission on <function ks.plus_one\(int\)> or any of its parents") + r"User mike has no AUTHORIZE permission on <function ks.plus_one\(int\)> or any of its parents") self.superuser.execute("GRANT AUTHORIZE ON FUNCTION ks.plus_one(int) TO mike") as_mike.execute(cql) # now revoke AUTHORIZE from mike self.superuser.execute("REVOKE AUTHORIZE ON FUNCTION ks.plus_one(int) FROM mike") cql = "REVOKE EXECUTE ON FUNCTION ks.plus_one(int) FROM role1" assert_unauthorized(as_mike, cql, - "User mike has no AUTHORIZE permission on <function ks.plus_one\(int\)> or any of its parents") + r"User mike has no AUTHORIZE permission on <function ks.plus_one\(int\)> or any of its parents") self.superuser.execute("GRANT AUTHORIZE ON FUNCTION ks.plus_one(int) TO mike") as_mike.execute(cql) # can't drop a function without DROP cql = "DROP FUNCTION ks.plus_one(int)" assert_unauthorized(as_mike, cql, - "User mike has no DROP permission on <function ks.plus_one\(int\)> or any of its parents") + r"User mike has no DROP permission on <function ks.plus_one\(int\)> or any of its parents") self.superuser.execute("GRANT DROP ON FUNCTION ks.plus_one(int) TO mike") as_mike.execute(cql) @@ -2287,7 +2287,7 @@ class TestAuthRoles(Tester): cql = "DROP FUNCTION ks.no_such_function(int,int)" assert_invalid(as_mike, cql, - "Unconfigured function ks.no_such_function\(int,int\)", + r"Unconfigured function ks.no_such_function\(int,int\)", InvalidRequest) # can't create a new function without CREATE on the parent keyspace's collection of functions @@ -2467,7 +2467,7 @@ class TestAuthRoles(Tester): as_mike = self.get_session(user='mike', password='12345') assert_unauthorized(as_mike, cql, - "User mike has no EXECUTE permission on <function ks.plus_one\(int\)> or any of its parents") + r"User mike has no EXECUTE permission on <function ks.plus_one\(int\)> or any of its parents") self.superuser.execute("GRANT EXECUTE ON FUNCTION ks.plus_one(int) TO mike") return as_mike.execute(cql) @@ -2489,7 +2489,7 @@ class TestAuthRoles(Tester): select = "SELECT k, v, ks.plus_one(v) FROM ks.t1 WHERE k = 1" assert_unauthorized(as_mike, select, - "User mike has no EXECUTE permission on <function ks.plus_one\(int\)> or any of its parents") + r"User mike has no EXECUTE permission on <function ks.plus_one\(int\)> or any of its parents") self.superuser.execute("GRANT function_user TO mike") assert_one(as_mike, select, [1, 1, 2]) @@ -2591,11 +2591,11 @@ class TestAuthRoles(Tester): # check permissions to create the aggregate assert_unauthorized(as_mike, create_aggregate_cql, - "User mike has no EXECUTE permission on <function ks.state_function\(int, int\)> or any of its parents") + r"User mike has no EXECUTE permission on <function ks.state_function\(int, int\)> or any of its parents") self.superuser.execute("GRANT EXECUTE ON FUNCTION ks.state_function(int, int) TO mike") assert_unauthorized(as_mike, create_aggregate_cql, - "User mike has no EXECUTE permission on <function ks.final_function\(int\)> or any of its parents") + r"User mike has no EXECUTE permission on <function ks.final_function\(int\)> or any of its parents") self.superuser.execute("GRANT EXECUTE ON FUNCTION ks.final_function(int) TO mike") as_mike.execute(create_aggregate_cql) @@ -2606,11 +2606,11 @@ class TestAuthRoles(Tester): execute_aggregate_cql = "SELECT ks.simple_aggregate(v) FROM ks.t1" assert_unauthorized(as_mike, execute_aggregate_cql, - "User mike has no EXECUTE permission on <function ks.state_function\(int, int\)> or any of its parents") + r"User mike has no EXECUTE permission on <function ks.state_function\(int, int\)> or any of its parents") self.superuser.execute("GRANT EXECUTE ON FUNCTION ks.state_function(int, int) TO mike") assert_unauthorized(as_mike, execute_aggregate_cql, - "User mike has no EXECUTE permission on <function ks.final_function\(int\)> or any of its parents") + r"User mike has no EXECUTE permission on <function ks.final_function\(int\)> or any of its parents") self.superuser.execute("GRANT EXECUTE ON FUNCTION ks.final_function(int) TO mike") # mike *does* have execute permission on the aggregate function, as its creator http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/batch_test.py ---------------------------------------------------------------------- diff --git a/batch_test.py b/batch_test.py index 7e7b6b2..48b6d87 100644 --- a/batch_test.py +++ b/batch_test.py @@ -81,7 +81,7 @@ class TestBatch(Tester): APPLY BATCH """) node1 = self.cluster.nodelist()[0] - warning = node1.grep_log("Executing a LOGGED BATCH on table \[ks.users\], configured with a " + warning = node1.grep_log(r"Executing a LOGGED BATCH on table \[ks.users\], configured with a " "gc_grace_seconds of 0. The gc_grace_seconds is used to TTL " "batchlog entries, so setting gc_grace_seconds too low on tables " "involved in an atomic batch might cause batchlog entries to expire " @@ -108,7 +108,7 @@ class TestBatch(Tester): APPLY BATCH """) node1 = self.cluster.nodelist()[0] - warning = node1.grep_log("Executing a LOGGED BATCH on tables \[ks.views, ks.users\], configured with a " + warning = node1.grep_log(r"Executing a LOGGED BATCH on tables \[ks.views, ks.users\], configured with a " "gc_grace_seconds of 0. The gc_grace_seconds is used to TTL " "batchlog entries, so setting gc_grace_seconds too low on tables " "involved in an atomic batch might cause batchlog entries to expire " http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/commitlog_test.py ---------------------------------------------------------------------- diff --git a/commitlog_test.py b/commitlog_test.py index c8830cd..19fd385 100644 --- a/commitlog_test.py +++ b/commitlog_test.py @@ -273,7 +273,7 @@ class TestCommitLog(Tester): node1.start() node1.watch_log_for("Log replay complete") # Here we verify from the logs that some mutations were replayed - replays = [match_tuple[0] for match_tuple in node1.grep_log(" \d+ replayed mutations")] + replays = [match_tuple[0] for match_tuple in node1.grep_log(r" \d+ replayed mutations")] logger.debug('The following log lines indicate that mutations were replayed: {msgs}'.format(msgs=replays)) num_replayed_mutations = [ parse('{} {num_mutations:d} replayed mutations{}', line).named['num_mutations'] @@ -379,7 +379,7 @@ class TestCommitLog(Tester): }) self._provoke_commitlog_failure() - failure = self.node1.grep_log("ERROR \[COMMIT-LOG-ALLOCATOR\].+JVM state determined to be unstable. Exiting forcefully") + failure = self.node1.grep_log(r"ERROR \[COMMIT-LOG-ALLOCATOR\].+JVM state determined to be unstable. Exiting forcefully") logger.debug(failure) assert failure, "Cannot find the commitlog failure message in logs" assert not self.node1.is_running(), "Node1 should not be running" @@ -393,7 +393,7 @@ class TestCommitLog(Tester): }) self._provoke_commitlog_failure() - failure = self.node1.grep_log("ERROR \[COMMIT-LOG-ALLOCATOR\].+Failed .+ commit log segments") + failure = self.node1.grep_log(r"ERROR \[COMMIT-LOG-ALLOCATOR\].+Failed .+ commit log segments") assert failure, "Cannot find the commitlog failure message in logs" assert self.node1.is_running(), "Node1 should still be running" http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/concurrent_schema_changes_test.py ---------------------------------------------------------------------- diff --git a/concurrent_schema_changes_test.py b/concurrent_schema_changes_test.py index d0af49c..a975876 100644 --- a/concurrent_schema_changes_test.py +++ b/concurrent_schema_changes_test.py @@ -125,7 +125,7 @@ class TestConcurrentSchemaChanges(Tester): response = node.nodetool('describecluster').stdout schemas = response.split('Schema versions:')[1].strip() - num_schemas = len(re.findall('\[.*?\]', schemas)) + num_schemas = len(re.findall(r'\[.*?\]', schemas)) assert num_schemas, 1 == "There were multiple schema versions: {}".format(pprint.pformat(schemas)) def test_create_lots_of_tables_concurrently(self): http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/conftest.py ---------------------------------------------------------------------- diff --git a/conftest.py b/conftest.py index 0040ec6..5b1a276 100644 --- a/conftest.py +++ b/conftest.py @@ -174,7 +174,7 @@ def fixture_maybe_skip_tests_requiring_novnodes(request): has vnodes enabled. This should always be a no-op as we explicitly deselect tests in pytest_collection_modifyitems that match this configuration -- but this is explicit :) """ - if request.node.get_marker('no_vnodes'): + if request.node.get_closest_marker('no_vnodes'): if request.config.getoption("--use-vnodes"): pytest.skip("Skipping test marked with no_vnodes as tests executed with vnodes enabled via the " "--use-vnodes command line argument") @@ -356,13 +356,13 @@ def _skip_msg(current_running_version, since_version, max_version): @pytest.fixture(autouse=True) def fixture_since(request, fixture_dtest_setup): - if request.node.get_marker('since'): - max_version_str = request.node.get_marker('since').kwargs.get('max_version', None) + if request.node.get_closest_marker('since'): + max_version_str = request.node.get_closest_marker('since').kwargs.get('max_version', None) max_version = None if max_version_str: max_version = LooseVersion(max_version_str) - since_str = request.node.get_marker('since').args[0] + since_str = request.node.get_closest_marker('since').args[0] since = LooseVersion(since_str) # use cassandra_version_from_build as it's guaranteed to be a LooseVersion # whereas cassandra_version may be a string if set in the cli options @@ -374,12 +374,11 @@ def fixture_since(request, fixture_dtest_setup): @pytest.fixture(autouse=True) def fixture_skip_version(request, fixture_dtest_setup): - marker = request.node.get_marker('skip_version') + marker = request.node.get_closest_marker('skip_version') if marker is not None: - for info in marker: - version_to_skip = LooseVersion(info.args[0]) - if version_to_skip == fixture_dtest_setup.dtest_config.cassandra_version_from_build: - pytest.skip("Test marked not to run on version %s" % version_to_skip) + version_to_skip = LooseVersion(marker.args[0]) + if version_to_skip == fixture_dtest_setup.dtest_config.cassandra_version_from_build: + pytest.skip("Test marked not to run on version %s" % version_to_skip) @pytest.fixture(scope='session', autouse=True) @@ -434,7 +433,7 @@ def pytest_collection_modifyitems(items, config): for item in items: deselect_test = False - if item.get_marker("resource_intensive"): + if item.get_closest_marker("resource_intensive"): if config.getoption("--force-resource-intensive-tests"): pass if config.getoption("--skip-resource-intensive-tests"): @@ -445,13 +444,13 @@ def pytest_collection_modifyitems(items, config): deselect_test = True logger.info("SKIP: Deselecting resource_intensive test %s due to insufficient system resources" % item.name) - if item.get_marker("no_vnodes"): + if item.get_closest_marker("no_vnodes"): if config.getoption("--use-vnodes"): deselect_test = True logger.info("SKIP: Deselecting test %s as the test requires vnodes to be disabled. To run this test, " "re-run without the --use-vnodes command line argument" % item.name) - if item.get_marker("vnodes"): + if item.get_closest_marker("vnodes"): if not config.getoption("--use-vnodes"): deselect_test = True logger.info("SKIP: Deselecting test %s as the test requires vnodes to be enabled. To run this test, " @@ -466,11 +465,11 @@ def pytest_collection_modifyitems(items, config): if not config.getoption("--execute-upgrade-tests"): deselect_test = True - if item.get_marker("upgrade_test"): + if item.get_closest_marker("upgrade_test"): if not config.getoption("--execute-upgrade-tests"): deselect_test = True - if item.get_marker("no_offheap_memtables"): + if item.get_closest_marker("no_offheap_memtables"): if config.getoption("use_off_heap_memtables"): deselect_test = True http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/cqlsh_tests/cqlsh_tests.py ---------------------------------------------------------------------- diff --git a/cqlsh_tests/cqlsh_tests.py b/cqlsh_tests/cqlsh_tests.py index 1d6e96e..ef38ee2 100644 --- a/cqlsh_tests/cqlsh_tests.py +++ b/cqlsh_tests/cqlsh_tests.py @@ -1629,7 +1629,7 @@ Tracing session:""") # Can't check escape sequence on cmd prompt. Assume no errors is good enough metric. if not common.is_win(): - assert re.search(chr(27) + "\[[0,1,2]?J", out) + assert re.search(chr(27) + r"\[[0,1,2]?J", out) def test_batch(self): """ http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/dtest.py ---------------------------------------------------------------------- diff --git a/dtest.py b/dtest.py index 4dcbd39..095ccd0 100644 --- a/dtest.py +++ b/dtest.py @@ -171,8 +171,8 @@ def cleanup_docker_environment_before_test_execution(): mode there is no way for us to do this. """ # attempt to wack all existing running Cassandra processes forcefully to get us into a clean state - p_kill = subprocess.Popen('ps aux | grep -ie CassandraDaemon | grep java | awk \'{print $2}\' | xargs kill -9', - shell=True) + p_kill = subprocess.Popen('ps aux | grep -ie CassandraDaemon | grep java | grep -v grep | awk \'{print $2}\' | xargs kill -9', + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True) p_kill.wait(timeout=10) # explicitly call "sync" to flush everything that might be pending from a previous test http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/internode_messaging_test.py ---------------------------------------------------------------------- diff --git a/internode_messaging_test.py b/internode_messaging_test.py index d0d4d1f..3914210 100644 --- a/internode_messaging_test.py +++ b/internode_messaging_test.py @@ -44,5 +44,5 @@ class TestInternodeMessaging(Tester): # now, make sure node2 reconnects (and continues gossiping). # node.watch_log_for() will time out if it cannot find the log entry - assert node2.grep_log('successfully connected to 127.0.0.1:7000 \(GOSSIP\)', + assert node2.grep_log(r'successfully connected to 127.0.0.1:7000 \(GOSSIP\)', from_mark=node2_log_mark, filename='debug.log') http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/jmx_test.py ---------------------------------------------------------------------- diff --git a/jmx_test.py b/jmx_test.py index 46adf3c..76d4c06 100644 --- a/jmx_test.py +++ b/jmx_test.py @@ -39,7 +39,7 @@ class TestJMX(Tester): node1.flush() node1.stop(gently=False) - with pytest.raises(ToolError, message="ConnectException: 'Connection refused( \(Connection refused\))?'."): + with pytest.raises(ToolError, message=r"ConnectException: 'Connection refused( \(Connection refused\))?'."): node1.nodetool('netstats') # don't wait; we're testing for when nodetool is called on a node mid-startup http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/materialized_views_test.py ---------------------------------------------------------------------- diff --git a/materialized_views_test.py b/materialized_views_test.py index 717d799..feac99e 100644 --- a/materialized_views_test.py +++ b/materialized_views_test.py @@ -86,7 +86,7 @@ class TestMaterializedViews(Tester): def _settle_nodes(self): logger.debug("Settling all nodes") - stage_match = re.compile("(?P<name>\S+)\s+(?P<active>\d+)\s+(?P<pending>\d+)\s+(?P<completed>\d+)\s+(?P<blocked>\d+)\s+(?P<alltimeblocked>\d+)") + stage_match = re.compile(r"(?P<name>\S+)\s+(?P<active>\d+)\s+(?P<pending>\d+)\s+(?P<completed>\d+)\s+(?P<blocked>\d+)\s+(?P<alltimeblocked>\d+)") def _settled_stages(node): (stdout, stderr, rc) = node.nodetool("tpstats") @@ -2693,12 +2693,11 @@ class TestMaterializedViewsConsistency(Tester): output = "\r{}".format(row) for key in list(self.exception_type.keys()): output = "{} ({}: {})".format(output, key, self.exception_type[key]) - sys.stdout.write(output) - sys.stdout.flush() + logger.debug(output) def _print_read_status(self, row): if self.counts[MutationPresence.unknown] == 0: - sys.stdout.write( + logger.debug( "\rOn {}; match: {}; extra: {}; missing: {}".format( row, self.counts[MutationPresence.match], @@ -2706,7 +2705,7 @@ class TestMaterializedViewsConsistency(Tester): self.counts[MutationPresence.missing]) ) else: - sys.stdout.write( + logger.debug( "\rOn {}; match: {}; extra: {}; missing: {}; WTF: {}".format( row, self.counts[MutationPresence.match], @@ -2714,7 +2713,6 @@ class TestMaterializedViewsConsistency(Tester): self.counts[MutationPresence.missing], self.counts[MutationPresence.unkown]) ) - sys.stdout.flush() def _do_row(self, insert_stmt, i, num_partitions): @@ -2846,12 +2844,10 @@ class TestMaterializedViewsConsistency(Tester): pytest.skip("Failed to get range {range} within timeout from queue. {error}".format(range=i, error=str(e))) if not mm.out() is None: - sys.stdout.write("\r{}\n" .format(mm.out())) + logger.debug("\r{}\n" .format(mm.out())) self.counts[mm.mp] += 1 self._print_read_status(upper) - sys.stdout.write("\n") - sys.stdout.flush() for thread in threads: thread.join(timeout=300) http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/repair_tests/deprecated_repair_test.py ---------------------------------------------------------------------- diff --git a/repair_tests/deprecated_repair_test.py b/repair_tests/deprecated_repair_test.py index 739f5e6..b11b08c 100644 --- a/repair_tests/deprecated_repair_test.py +++ b/repair_tests/deprecated_repair_test.py @@ -165,10 +165,10 @@ class TestDeprecatedRepairAPI(Tester): # wait for log to start node1.watch_log_for("Starting repair command") # get repair parameters from the log - line = node1.grep_log(("Starting repair command #1" + (" \([^\)]+\)" if cluster.version() >= LooseVersion("3.10") else "") + - ", repairing keyspace ks with repair options \(parallelism: (?P<parallelism>\w+), primary range: (?P<pr>\w+), " - "incremental: (?P<incremental>\w+), job threads: (?P<jobs>\d+), ColumnFamilies: (?P<cfs>.+), dataCenters: (?P<dc>.+), " - "hosts: (?P<hosts>.+), # of ranges: (?P<ranges>\d+)(, pull repair: (?P<pullrepair>true|false))?\)")) + line = node1.grep_log((r"Starting repair command #1" + (r" \([^\)]+\)" if cluster.version() >= LooseVersion("3.10") else "") + + r", repairing keyspace ks with repair options \(parallelism: (?P<parallelism>\w+), primary range: (?P<pr>\w+), " + r"incremental: (?P<incremental>\w+), job threads: (?P<jobs>\d+), ColumnFamilies: (?P<cfs>.+), dataCenters: (?P<dc>.+), " + r"hosts: (?P<hosts>.+), # of ranges: (?P<ranges>\d+)(, pull repair: (?P<pullrepair>true|false))?\)")) assert_length_equal(line, 1) line, m = line[0] http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/repair_tests/repair_test.py ---------------------------------------------------------------------- diff --git a/repair_tests/repair_test.py b/repair_tests/repair_test.py index 3264671..9ebceae 100644 --- a/repair_tests/repair_test.py +++ b/repair_tests/repair_test.py @@ -140,7 +140,7 @@ class BaseRepairTest(Tester): logger.debug("Repair time: {end}".format(end=time.time() - start)) # Validate that only one range was transfered - out_of_sync_logs = node1.grep_log("{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) + out_of_sync_logs = node1.grep_log(r"{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) assert len(out_of_sync_logs) == 2, "Lines matching: " + str([elt[0] for elt in out_of_sync_logs]) @@ -276,7 +276,7 @@ class TestRepair(BaseRepairTest): Based on incremental_repair_test.py:TestIncRepair implementation. """ _sstable_name = re.compile('SSTable: (.+)') - _repaired_at = re.compile('Repaired at: (\d+)') + _repaired_at = re.compile(r'Repaired at: (\d+)') _sstable_data = namedtuple('_sstabledata', ('name', 'repaired')) out = node.run_sstablemetadata(keyspace=keyspace).stdout @@ -520,10 +520,10 @@ class TestRepair(BaseRepairTest): assert len([x for x in res if len(x) != 0]) == 0, res # check log for no repair happened for gcable data - out_of_sync_logs = node2.grep_log("{} and {} have ([0-9]+) range\(s\) out of sync for cf1".format(cluster.address_regex(), cluster.address_regex())) + out_of_sync_logs = node2.grep_log(r"{} and {} have ([0-9]+) range\(s\) out of sync for cf1".format(cluster.address_regex(), cluster.address_regex())) assert len(out_of_sync_logs) == 0, "GC-able data does not need to be repaired with empty data: " + str([elt[0] for elt in out_of_sync_logs]) # check log for actual repair for non gcable data - out_of_sync_logs = node2.grep_log("{} and {} have ([0-9]+) range\(s\) out of sync for cf2".format(cluster.address_regex(), cluster.address_regex())) + out_of_sync_logs = node2.grep_log(r"{} and {} have ([0-9]+) range\(s\) out of sync for cf2".format(cluster.address_regex(), cluster.address_regex())) assert len(out_of_sync_logs) > 0, "Non GC-able data should be repaired" def _range_tombstone_digest(self, sequential): @@ -599,7 +599,7 @@ class TestRepair(BaseRepairTest): node2.repair(_repair_options(self.cluster.version(), ks='ks', sequential=sequential)) # check log for no repair happened for gcable data - out_of_sync_logs = node2.grep_log("{} and {} have ([0-9]+) range\(s\) out of sync for table1".format(cluster.address_regex(), cluster.address_regex())) + out_of_sync_logs = node2.grep_log(r"{} and {} have ([0-9]+) range\(s\) out of sync for table1".format(cluster.address_regex(), cluster.address_regex())) assert len(out_of_sync_logs) == 0, "Digest mismatch for range tombstone: {}".format(str([elt[0] for elt in out_of_sync_logs])) def test_local_dc_repair(self): @@ -618,7 +618,7 @@ class TestRepair(BaseRepairTest): node1.repair(opts) # Verify that only nodes in dc1 are involved in repair - out_of_sync_logs = node1.grep_log("{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) + out_of_sync_logs = node1.grep_log(r"{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) assert len(out_of_sync_logs) == 1, "Lines matching: {}".format(len(out_of_sync_logs)) line, m = out_of_sync_logs[0] @@ -647,7 +647,7 @@ class TestRepair(BaseRepairTest): node1.repair(opts) # Verify that only nodes in dc1 and dc2 are involved in repair - out_of_sync_logs = node1.grep_log("{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) + out_of_sync_logs = node1.grep_log(r"{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) assert len(out_of_sync_logs) == 2, "Lines matching: " + str([elt[0] for elt in out_of_sync_logs]) valid_out_of_sync_pairs = [{node1.address(), node2.address()}, {node2.address(), node3.address()}] @@ -677,7 +677,7 @@ class TestRepair(BaseRepairTest): node1.repair(opts) # Verify that only nodes in dc1 and dc2 are involved in repair - out_of_sync_logs = node1.grep_log("{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) + out_of_sync_logs = node1.grep_log(r"{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) assert len(out_of_sync_logs) == 2, "Lines matching: " + str([elt[0] for elt in out_of_sync_logs]) valid_out_of_sync_pairs = [{node1.address(), node2.address()}, {node2.address(), node3.address()}] @@ -839,7 +839,7 @@ class TestRepair(BaseRepairTest): node1.repair(opts) assert len(node1.grep_log('are consistent for standard1')) == 0, "Nodes 1 and 2 should not be consistent." assert len(node3.grep_log('Repair command')) == 0, "Node 3 should not have been involved in the repair." - out_of_sync_logs = node1.grep_log("{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) + out_of_sync_logs = node1.grep_log(r"{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) assert len(out_of_sync_logs) == 0, "We repaired the wrong CF == so things should still be broke" # Repair only the range node 1 owns on the right CF, assert everything is fixed @@ -848,7 +848,7 @@ class TestRepair(BaseRepairTest): node1.repair(opts) assert len(node1.grep_log('are consistent for standard1')) == 0, "Nodes 1 and 2 should not be consistent." assert len(node3.grep_log('Repair command')) == 0, "Node 3 should not have been involved in the repair." - out_of_sync_logs = node1.grep_log("{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) + out_of_sync_logs = node1.grep_log(r"{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) _, matches = out_of_sync_logs[0] out_of_sync_nodes = {matches.group(1), matches.group(2)} valid_out_of_sync_pairs = [{node1.address(), node2.address()}] @@ -945,7 +945,7 @@ class TestRepair(BaseRepairTest): assert len(node1.grep_log('are consistent for standard1')) == 0, "Nodes 1 and 2 should not be consistent." assert len(node3.grep_log('Repair command')) == 0, "Node 3 should not have been involved in the repair." - out_of_sync_logs = node1.grep_log("{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) + out_of_sync_logs = node1.grep_log(r"{} and {} have ([0-9]+) range\(s\) out of sync".format(cluster.address_regex(), cluster.address_regex())) _, matches = out_of_sync_logs[0] out_of_sync_nodes = {matches.group(1), matches.group(2)} http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/replication_test.py ---------------------------------------------------------------------- diff --git a/replication_test.py b/replication_test.py index 8c29074..69287d6 100644 --- a/replication_test.py +++ b/replication_test.py @@ -15,10 +15,10 @@ since = pytest.mark.since logger = logging.getLogger(__name__) TRACE_DETERMINE_REPLICAS = re.compile('Determining replicas for mutation') -TRACE_SEND_MESSAGE = re.compile('Sending (?:MUTATION|REQUEST_RESPONSE) message to /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)') -TRACE_RESPOND_MESSAGE = re.compile('(?:MUTATION|REQUEST_RESPONSE) message received from /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)') +TRACE_SEND_MESSAGE = re.compile(r'Sending (?:MUTATION|REQUEST_RESPONSE) message to /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)') +TRACE_RESPOND_MESSAGE = re.compile(r'(?:MUTATION|REQUEST_RESPONSE) message received from /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)') TRACE_COMMIT_LOG = re.compile('Appending to commitlog') -TRACE_FORWARD_WRITE = re.compile('Enqueuing forwarded write to /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)') +TRACE_FORWARD_WRITE = re.compile(r'Enqueuing forwarded write to /([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)') # Some pre-computed murmur 3 hashes; there are no good python murmur3 # hashing libraries :( @@ -333,7 +333,7 @@ class TestSnitchConfigurationUpdate(Tester): """ Waits for nodes to match the expected racks. """ - regex = re.compile("^UN(?:\s*)127\.0\.0(?:.*)\s(.*)$", re.IGNORECASE) + regex = re.compile(r"^UN(?:\s*)127\.0\.0(?:.*)\s(.*)$", re.IGNORECASE) for i, node in enumerate(nodes): wait_expire = time.time() + 120 while time.time() < wait_expire: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/requirements.txt ---------------------------------------------------------------------- diff --git a/requirements.txt b/requirements.txt index 388a8a9..3b17b82 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ docopt enum34 flaky mock -pytest +pytest==3.6.4 pytest-timeout parse pycodestyle http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/run_dtests.py ---------------------------------------------------------------------- diff --git a/run_dtests.py b/run_dtests.py index ccd60b9..378029d 100755 --- a/run_dtests.py +++ b/run_dtests.py @@ -37,7 +37,7 @@ from os import getcwd from tempfile import NamedTemporaryFile from bs4 import BeautifulSoup -from _pytest.config import Parser +from _pytest.config.argparsing import Parser import argparse from conftest import pytest_addoption @@ -200,7 +200,7 @@ def collect_test_modules(stdout): """ # unfortunately, pytest emits xml like output -- but it's not actually xml, so we'll fail to parse # if we try. first step is to fix up the pytest output to create well formatted xml - xml_line_regex_pattern = re.compile("^([\s])*<(Module|Class|Function|Instance) '(.*)'>") + xml_line_regex_pattern = re.compile(r"^([\s])*<(Module|Class|Function|Instance) '(.*)'>") is_first_module = True is_first_class = True has_closed_class = False http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/secondary_indexes_test.py ---------------------------------------------------------------------- diff --git a/secondary_indexes_test.py b/secondary_indexes_test.py index 55b240e..cccd27a 100644 --- a/secondary_indexes_test.py +++ b/secondary_indexes_test.py @@ -1031,7 +1031,7 @@ class TestSecondaryIndexesOnCollections(Tester): stmt = "CREATE INDEX user_uuids_values on map_index_search.users (uuids);" if self.cluster.version() < '3.0': if self.cluster.version() >= '2.2': - matching = "Cannot create index on values\(uuids\): an index on keys\(uuids\) already exists and indexing a map on more than one dimension at the same time is not currently supported" + matching = r"Cannot create index on values\(uuids\): an index on keys\(uuids\) already exists and indexing a map on more than one dimension at the same time is not currently supported" else: matching = "Cannot create index on uuids values, an index on uuids keys already exists and indexing a map on both keys and values at the same time is not currently supported" assert_invalid(session, stmt, matching) http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/thrift_test.py ---------------------------------------------------------------------- diff --git a/thrift_test.py b/thrift_test.py index aaf9dd2..1cf06ea 100644 --- a/thrift_test.py +++ b/thrift_test.py @@ -1255,7 +1255,7 @@ class TestMutations(TestThrift): _insert_simple() assert get_range_slice(client, ColumnParent('Super1'), SlicePredicate(column_names=[utf8encode('c1'), utf8encode('c1')]), utf8encode(''), utf8encode(''), 1000, ConsistencyLevel.ONE) == [] - @since('2.1') + @since('2.1', max_version='4') def test_super_cql_read_compatibility(self): _set_keyspace('Keyspace1') self.truncate_all('Super1') @@ -1296,7 +1296,7 @@ class TestMutations(TestThrift): [[5, utf8encode("value5")], [6, utf8encode("value6")]]) - @since('2.1') + @since('2.1', max_version='4') def test_super_cql_write_compatibility(self): _set_keyspace('Keyspace1') self.truncate_all('Super1') @@ -2063,7 +2063,7 @@ class TestMutations(TestThrift): time.sleep(3) _expect_missing(lambda: client.get(utf8encode('key1'), ColumnPath('Expiring', column=utf8encode('cttl3')), ConsistencyLevel.ONE)) - @since('3.6') + @since('3.6', max_version='4') def test_expiration_with_default_ttl_and_zero_ttl(self): """ Test that we can remove the default ttl by setting the ttl explicitly to zero @@ -2644,7 +2644,7 @@ class TestMutations(TestThrift): assert _big_slice(utf8encode('key1'), ColumnParent('Super1')) == [] assert _big_slice(utf8encode('key1'), ColumnParent('Super1', utf8encode('sc1'))) == [] - @since('3.0') + @since('3.0', max_version='4') def test_cql_range_tombstone_and_static(self): node1 = self.cluster.nodelist()[0] session = self.patient_cql_connection(node1) http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/tools/assertions.py ---------------------------------------------------------------------- diff --git a/tools/assertions.py b/tools/assertions.py index a7552a0..2f826ae 100644 --- a/tools/assertions.py +++ b/tools/assertions.py @@ -284,7 +284,7 @@ def assert_stderr_clean(err, acceptable_errors=None): # Stress tool JMX connection failure, see CASSANDRA-12437 "Failed to connect over JMX; not collecting these stats"] - regex_str = "^({}|\s*|\n)*$".format("|".join(acceptable_errors)) + regex_str = r"^({}|\s*|\n)*$".format("|".join(acceptable_errors)) err_str = err.strip() # empty string, as good as we can get for a clean stderr output! if not err_str: http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/tools/datahelp.py ---------------------------------------------------------------------- diff --git a/tools/datahelp.py b/tools/datahelp.py index 86afc03..3cfe8a8 100644 --- a/tools/datahelp.py +++ b/tools/datahelp.py @@ -48,7 +48,7 @@ def parse_headers_into_list(data): def get_row_multiplier(row): # find prefix like *1234 meaning create 1,234 rows row_cells = [l.strip() for l in row.split('|')] - m = re.findall('\*(\d+)$', row_cells[0]) + m = re.findall(r'\*(\d+)$', row_cells[0]) if m: return int(m[0]) http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/tools/jmxutils.py ---------------------------------------------------------------------- diff --git a/tools/jmxutils.py b/tools/jmxutils.py index b0d6c68..dbc6e75 100644 --- a/tools/jmxutils.py +++ b/tools/jmxutils.py @@ -69,61 +69,61 @@ def enable_jmx_ssl(node, """ # mandatory replacements when enabling SSL replacement_list = [ - ('\$env:JVM_OPTS="\$env:JVM_OPTS -Dcassandra.jmx.local.port=$JMX_PORT")', + (r'\$env:JVM_OPTS="\$env:JVM_OPTS -Dcassandra.jmx.local.port=$JMX_PORT")', '#$env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.jmx.local.port=$JMX_PORT"'), - ('#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"', + (r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"', '$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"'), - ('#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcom.sun.management.jmxremote.ssl=true"', + (r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcom.sun.management.jmxremote.ssl=true"', '$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.ssl=true"') ] if common.is_win() else [ ('LOCAL_JMX=yes', 'LOCAL_JMX=no'), - ('#JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=true"', + (r'#JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=true"', 'JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=true"'), - ('JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=\$JMX_PORT"', + (r'JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=\$JMX_PORT"', '#JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"') ] if require_client_auth: if common.is_win(): - replacement_list.append(('#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcom.sun.management.jmxremote.ssl.need.client.auth=true"', + replacement_list.append((r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcom.sun.management.jmxremote.ssl.need.client.auth=true"', '$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.ssl.need.client.auth=true"')) else: - replacement_list.append(('#JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.need.client.auth=true"', + replacement_list.append((r'#JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.need.client.auth=true"', 'JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl.need.client.auth=true"')) if keystore: if common.is_win(): - replacement_list.append(('#\$env:JVM_OPTS="\$env:JVM_OPTS -Djavax.net.ssl.keyStore=C:/keystore"', + replacement_list.append((r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Djavax.net.ssl.keyStore=C:/keystore"', '$env:JVM_OPTS="$env:JVM_OPTS -Djavax.net.ssl.keyStore={path}"'.format(path=keystore))) else: - replacement_list.append(('#JVM_OPTS="\$JVM_OPTS -Djavax.net.ssl.keyStore=/path/to/keystore"', + replacement_list.append((r'#JVM_OPTS="\$JVM_OPTS -Djavax.net.ssl.keyStore=/path/to/keystore"', 'JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.keyStore={path}"'.format(path=keystore))) if keystore_password: if common.is_win(): - replacement_list.append(('#\$env:JVM_OPTS="\$env:JVM_OPTS -Djavax.net.ssl.keyStorePassword=<keystore-password>"', + replacement_list.append((r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Djavax.net.ssl.keyStorePassword=<keystore-password>"', '$env:JVM_OPTS="$env:JVM_OPTS -Djavax.net.ssl.keyStorePassword={password}"'.format(password=keystore_password))) else: - replacement_list.append(('#JVM_OPTS="\$JVM_OPTS -Djavax.net.ssl.keyStorePassword=<keystore-password>"', + replacement_list.append((r'#JVM_OPTS="\$JVM_OPTS -Djavax.net.ssl.keyStorePassword=<keystore-password>"', 'JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.keyStorePassword={password}"'.format(password=keystore_password))) if truststore: if common.is_win(): - replacement_list.append(('#\$env:JVM_OPTS="\$env:JVM_OPTS -Djavax.net.ssl.trustStore=C:/truststore"', + replacement_list.append((r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Djavax.net.ssl.trustStore=C:/truststore"', '$env:JVM_OPTS="$env:JVM_OPTS -Djavax.net.ssl.trustStore={path}"'.format(path=truststore))) else: - replacement_list.append(('#JVM_OPTS="\$JVM_OPTS -Djavax.net.ssl.trustStore=/path/to/truststore"', + replacement_list.append((r'#JVM_OPTS="\$JVM_OPTS -Djavax.net.ssl.trustStore=/path/to/truststore"', 'JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.trustStore={path}"'.format(path=truststore))) if truststore_password: if common.is_win(): - replacement_list.append(('#\$env:JVM_OPTS="\$env:JVM_OPTS -Djavax.net.ssl.trustStorePassword=<truststore-password>"', + replacement_list.append((r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Djavax.net.ssl.trustStorePassword=<truststore-password>"', '$env:JVM_OPTS="$env:JVM_OPTS -Djavax.net.ssl.trustStorePassword={password}"'.format(password=truststore_password))) else: - replacement_list.append(('#JVM_OPTS="\$JVM_OPTS -Djavax.net.ssl.trustStorePassword=<truststore-password>"', + replacement_list.append((r'#JVM_OPTS="\$JVM_OPTS -Djavax.net.ssl.trustStorePassword=<truststore-password>"', 'JVM_OPTS="$JVM_OPTS -Djavax.net.ssl.trustStorePassword={password}"'.format(password=truststore_password))) # switches off user authentication, distinct from validation of client certificates (i.e. require_client_auth) if disable_user_auth: if not common.is_win(): - replacement_list.append(('JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true"', + replacement_list.append((r'JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true"', 'JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"')) common.replaces_in_file(node.envfilename(), replacement_list) @@ -131,24 +131,24 @@ def enable_jmx_ssl(node, def apply_jmx_authentication(node): replacement_list = [ - ('#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true"', + (r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true"', '$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true"'), - ('#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcassandra.jmx.remote.login.config=CassandraLogin"', + (r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcassandra.jmx.remote.login.config=CassandraLogin"', '$env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.jmx.remote.login.config=CassandraLogin"'), - ('#\$env:JVM_OPTS="\$env:JVM_OPTS -Djava.security.auth.login.config=C:/cassandra-jaas.config"', - '$env:JVM_OPTS="$env:JVM_OPTS -Djava.security.auth.login.config=$env:CASSANDRA_HOME\conf\cassandra-jaas.config"'), - ('#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcassandra.jmx.authorizer=org.apache.cassandra.auth.jmx.AuthorizationProxy"', + (r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Djava.security.auth.login.config=C:/cassandra-jaas.config"', + r'$env:JVM_OPTS="$env:JVM_OPTS -Djava.security.auth.login.config=$env:CASSANDRA_HOME\conf\cassandra-jaas.config"'), + (r'#\$env:JVM_OPTS="\$env:JVM_OPTS -Dcassandra.jmx.authorizer=org.apache.cassandra.auth.jmx.AuthorizationProxy"', '$env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.jmx.authorizer=org.apache.cassandra.auth.jmx.AuthorizationProxy"') ] if common.is_win() else [ - ('JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"', + (r'JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"', 'JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true"'), - ('JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.password.file=/etc/cassandra/jmxremote.password"', + (r'JVM_OPTS="\$JVM_OPTS -Dcom.sun.management.jmxremote.password.file=/etc/cassandra/jmxremote.password"', '#JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.password.file=/etc/cassandra/jmxremote.password"'), - ('#JVM_OPTS="\$JVM_OPTS -Dcassandra.jmx.remote.login.config=CassandraLogin"', + (r'#JVM_OPTS="\$JVM_OPTS -Dcassandra.jmx.remote.login.config=CassandraLogin"', 'JVM_OPTS="$JVM_OPTS -Dcassandra.jmx.remote.login.config=CassandraLogin"'), - ('#JVM_OPTS="\$JVM_OPTS -Djava.security.auth.login.config=\$CASSANDRA_HOME/conf/cassandra-jaas.config"', + (r'#JVM_OPTS="\$JVM_OPTS -Djava.security.auth.login.config=\$CASSANDRA_HOME/conf/cassandra-jaas.config"', 'JVM_OPTS="$JVM_OPTS -Djava.security.auth.login.config=$CASSANDRA_HOME/conf/cassandra-jaas.config"'), - ('#JVM_OPTS="\$JVM_OPTS -Dcassandra.jmx.authorizer=org.apache.cassandra.auth.jmx.AuthorizationProxy"', + (r'#JVM_OPTS="\$JVM_OPTS -Dcassandra.jmx.authorizer=org.apache.cassandra.auth.jmx.AuthorizationProxy"', 'JVM_OPTS="$JVM_OPTS -Dcassandra.jmx.authorizer=org.apache.cassandra.auth.jmx.AuthorizationProxy"') ] @@ -162,7 +162,7 @@ def remove_perf_disable_shared_mem(node): edits cassandra-env.sh (or the Windows equivalent), or jvm.options file on 3.2+ to remove that option. """ if node.get_cassandra_version() >= LooseVersion('3.2'): - pattern = '\-XX:\+PerfDisableSharedMem' + pattern = r'\-XX:\+PerfDisableSharedMem' replacement = '#-XX:+PerfDisableSharedMem' for f in glob.glob(os.path.join(node.get_conf_dir(), common.JVM_OPTS_PATTERN)): if os.path.isfile(f): http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/topology_test.py ---------------------------------------------------------------------- diff --git a/topology_test.py b/topology_test.py index 1748f1d..bb0e809 100644 --- a/topology_test.py +++ b/topology_test.py @@ -428,7 +428,7 @@ class TestTopology(Tester): t.start() node1.watch_log_for("DECOMMISSIONING", filename='debug.log') - null_status_pattern = re.compile(".N(?:\s*)127\.0\.0\.1(?:.*)null(?:\s*)rack1") + null_status_pattern = re.compile(r".N(?:\s*)127\.0\.0\.1(?:.*)null(?:\s*)rack1") while t.is_alive(): out = self.show_status(node2) if null_status_pattern.search(out): http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/transient_replication_test.py ---------------------------------------------------------------------- diff --git a/transient_replication_test.py b/transient_replication_test.py index 8e47add..7cfd4f3 100644 --- a/transient_replication_test.py +++ b/transient_replication_test.py @@ -140,9 +140,9 @@ def patch_start(startable): return startable def get_sstable_data(cls, node, keyspace): - _sstable_name = re.compile('SSTable: (.+)') - _repaired_at = re.compile('Repaired at: (\d+)') - _pending_repair = re.compile('Pending repair: (\-\-|null|[a-f0-9\-]+)') + _sstable_name = re.compile(r'SSTable: (.+)') + _repaired_at = re.compile(r'Repaired at: (\d+)') + _pending_repair = re.compile(r'Pending repair: (\-\-|null|[a-f0-9\-]+)') out = node.run_sstablemetadata(keyspace=keyspace).stdout http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/upgrade_tests/regression_test.py ---------------------------------------------------------------------- diff --git a/upgrade_tests/regression_test.py b/upgrade_tests/regression_test.py index d3cd914..2e16645 100644 --- a/upgrade_tests/regression_test.py +++ b/upgrade_tests/regression_test.py @@ -144,7 +144,7 @@ class TestForRegressions(UpgradeTester): response = n.nodetool('describecluster').stdout logger.debug(response) schemas = response.split('Schema versions:')[1].strip() - num_schemas = len(re.findall('\[.*?\]', schemas)) + num_schemas = len(re.findall(r'\[.*?\]', schemas)) self.assertEqual(num_schemas, 1, "There were multiple schema versions during an upgrade: {}" .format(schemas)) http://git-wip-us.apache.org/repos/asf/cassandra-dtest/blob/77be87ec/upgrade_tests/upgrade_schema_agreement_test.py ---------------------------------------------------------------------- diff --git a/upgrade_tests/upgrade_schema_agreement_test.py b/upgrade_tests/upgrade_schema_agreement_test.py index 4c8d942..13ff744 100644 --- a/upgrade_tests/upgrade_schema_agreement_test.py +++ b/upgrade_tests/upgrade_schema_agreement_test.py @@ -208,7 +208,7 @@ class TestSchemaAgreementUpgrade(Tester): logger.debug("nodetool describecluster of {}:".format(n.name)) logger.debug(out) versions = out.split('Schema versions:')[1].strip() - num_schemas = len(re.findall('\[.*?\]', versions)) + num_schemas = len(re.findall(r'\[.*?\]', versions)) self.assertEqual(num_schemas, 1, "Multiple schema versions detected on {}: {}".format(n.name, out)) def upgrade_schema_agreement_30_3112_test(self): --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org