You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2023/01/20 21:29:34 UTC
[cassandra-dtest] branch trunk updated (36da75d9 -> ba6a2448)
This is an automated email from the ASF dual-hosted git repository.
brandonwilliams pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git
from 36da75d9 remove travis.yml per asf policy
new 9cd503ce Add python 3.11 support
new ba6a2448 Fix logging in ttl test
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
client_request_metrics_local_remote_test.py | 8 ++++----
conftest.py | 21 ++++++++++++---------
consistency_test.py | 2 +-
jmx_test.py | 2 +-
pytest.ini | 15 ++++++++++++++-
rebuild_test.py | 14 ++++++++------
requirements.txt | 2 +-
tools/misc.py | 5 ++++-
ttl_test.py | 6 +++---
9 files changed, 48 insertions(+), 27 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[cassandra-dtest] 01/02: Add python 3.11 support
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git
commit 9cd503ce92b7eeb7e7e9557606d46c01b7267aea
Author: Brandon Williams <br...@apache.org>
AuthorDate: Thu Dec 15 09:14:05 2022 -0600
Add python 3.11 support
Patch by brandonwilliams; reviewed by bereng for CASSANDRA-18121
---
client_request_metrics_local_remote_test.py | 8 ++++----
conftest.py | 21 ++++++++++++---------
consistency_test.py | 2 +-
jmx_test.py | 2 +-
pytest.ini | 15 ++++++++++++++-
rebuild_test.py | 14 ++++++++------
requirements.txt | 2 +-
tools/misc.py | 5 ++++-
8 files changed, 45 insertions(+), 24 deletions(-)
diff --git a/client_request_metrics_local_remote_test.py b/client_request_metrics_local_remote_test.py
index 476d4626..8d817f9f 100644
--- a/client_request_metrics_local_remote_test.py
+++ b/client_request_metrics_local_remote_test.py
@@ -9,7 +9,7 @@ since = pytest.mark.since
class TestClientRequestMetricsLocalRemote(Tester):
def test_write_and_read(self):
- session, node = setup(self)
+ session, node = setup_test(self)
read_metrics = ClientRequestMetricsContainer(node, 'Read')
write_metrics = ClientRequestMetricsContainer(node, 'Write')
@@ -47,7 +47,7 @@ class TestClientRequestMetricsLocalRemote(Tester):
assert 0 < (r3_r.remote_requests - r2_r.remote_requests)
def test_batch_and_slice(self):
- session, node = setup(self)
+ session, node = setup_test(self)
read_metrics = ClientRequestMetricsContainer(node, 'Read')
write_metrics = ClientRequestMetricsContainer(node, 'Write')
@@ -89,7 +89,7 @@ class TestClientRequestMetricsLocalRemote(Tester):
assert 0 < (r3_r.remote_requests - r2_r.remote_requests)
def test_paxos(self):
- session, node = setup(self)
+ session, node = setup_test(self)
read_metrics = ClientRequestMetricsContainer(node, 'Read')
write_metrics = ClientRequestMetricsContainer(node, 'Write')
@@ -177,7 +177,7 @@ def setup_schema(session):
session.execute("CREATE TABLE test (id int,ord int,val varchar,PRIMARY KEY (id, ord));""")
-def setup(obj):
+def setup_test(obj):
cluster = obj.cluster
cluster.populate(2)
diff --git a/conftest.py b/conftest.py
index fac8f26d..5ba3de80 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1,5 +1,8 @@
import copy
-import collections
+try:
+ import collections.abc as collections
+except ImportError:
+ import collections
import logging
import os
import platform
@@ -149,7 +152,7 @@ def fixture_logging_setup(request):
log_level = logging.INFO
try:
# first see if logging level overridden by user as command line argument
- log_level_from_option = pytest.config.getoption("--log-level")
+ log_level_from_option = request.config.getoption("--log-level")
if log_level_from_option is not None:
log_level = logging.getLevelName(log_level_from_option)
else:
@@ -158,22 +161,22 @@ def fixture_logging_setup(request):
# nope, user didn't specify it as a command line argument to pytest, check if
# we have a default in the loaded pytest.ini. Note: words are seperated in variables
# in .ini land with a "_" while the command line arguments use "-"
- if pytest.config.inicfg.get("log_level") is not None:
- log_level = logging.getLevelName(pytest.config.inicfg.get("log_level"))
+ if request.config.inicfg.get("log_level") is not None:
+ log_level = logging.getLevelName(request.config.inicfg.get("log_level"))
logging.root.setLevel(log_level)
logging_format = None
try:
# first see if logging level overridden by user as command line argument
- log_format_from_option = pytest.config.getoption("--log-format")
+ log_format_from_option = request.config.getoption("--log-format")
if log_format_from_option is not None:
logging_format = log_format_from_option
else:
raise ValueError
except ValueError:
- if pytest.config.inicfg.get("log_format") is not None:
- logging_format = pytest.config.inicfg.get("log_format")
+ if request.config.inicfg.get("log_format") is not None:
+ logging_format = request.config.inicfg.get("log_format")
logging.basicConfig(level=log_level,
format=logging_format)
@@ -192,8 +195,8 @@ def fixture_logging_setup(request):
@pytest.fixture(scope="session")
def log_global_env_facts(fixture_dtest_config, fixture_logging_setup):
- if pytest.config.pluginmanager.hasplugin('junitxml'):
- my_junit = getattr(pytest.config, '_xml', None)
+ if fixture_dtest_config.config.pluginmanager.hasplugin('junitxml'):
+ my_junit = getattr(fixture_dtest_config.config, '_xml', None)
my_junit.add_global_property('USE_VNODES', fixture_dtest_config.use_vnodes)
diff --git a/consistency_test.py b/consistency_test.py
index 0175adfd..cf9056bb 100644
--- a/consistency_test.py
+++ b/consistency_test.py
@@ -556,7 +556,7 @@ class TestAccuracy(TestHelper):
logger.debug("Waiting for workers to complete")
while exceptions_queue.empty():
time.sleep(0.1)
- if len([t for t in threads if t.isAlive()]) == 0:
+ if len([t for t in threads if t.is_alive()]) == 0:
break
if not exceptions_queue.empty():
diff --git a/jmx_test.py b/jmx_test.py
index 762bb09c..8f7f8834 100644
--- a/jmx_test.py
+++ b/jmx_test.py
@@ -42,7 +42,7 @@ class TestJMX(Tester):
node1.flush()
node1.stop(gently=False)
- with pytest.raises(ToolError, message=r"ConnectException: 'Connection refused( \(Connection refused\))?'."):
+ with pytest.raises(ToolError, match=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
diff --git a/pytest.ini b/pytest.ini
index c8e85d44..6054229a 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,7 +1,20 @@
[pytest]
+addopts = --show-capture=stdout
python_files = test_*.py *_test.py *_tests.py
junit_suite_name = Cassandra dtests
-log_print = True
log_level = INFO
log_format = %(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s
timeout = 900
+markers =
+ since
+ vnodes
+ no_vnodes
+ resource_intensive
+ offheap_memtables
+ no_offheap_memtables
+ ported_to_in_jvm
+ env
+ skip_version
+ upgrade_test
+ depends_cqlshlib
+ depends_driver
diff --git a/rebuild_test.py b/rebuild_test.py
index 6f3a4455..3837ed18 100644
--- a/rebuild_test.py
+++ b/rebuild_test.py
@@ -217,17 +217,17 @@ class TestRebuild(Tester):
node3.byteman_submit(script)
# First rebuild must fail and data must be incomplete
- with pytest.raises(ToolError, message='Unexpected: SUCCEED'):
+ with pytest.raises(ToolError):
logger.debug('Executing first rebuild -> '),
node3.nodetool('rebuild dc1')
- logger.debug('Expected: FAILED')
+ pytest.fail("Expected: FAILED")
session.execute('USE ks')
- with pytest.raises(AssertionError, message='Unexpected: COMPLETE'):
+ with pytest.raises(AssertionError):
logger.debug('Checking data is complete -> '),
for i in range(0, 20000):
query_c1c2(session, i, ConsistencyLevel.LOCAL_ONE)
- logger.debug('Expected: INCOMPLETE')
+ pytest.fail('Expected: INCOMPLETE')
logger.debug('Executing second rebuild -> '),
node3.nodetool('rebuild dc1')
@@ -336,8 +336,9 @@ class TestRebuild(Tester):
session = self.patient_exclusive_cql_connection(node1)
session.execute("CREATE KEYSPACE ks1 WITH replication = {'class':'SimpleStrategy', 'replication_factor':2};")
- with pytest.raises(ToolError, match='is not a range that is owned by this node'):
+ with pytest.raises(ToolError):
node1.nodetool('rebuild -ks ks1 -ts (%s,%s]' % (node1_token, node2_token))
+ pytest.fail("range should not be owned by this node")
@since('3.10')
@pytest.mark.no_vnodes
@@ -372,8 +373,9 @@ class TestRebuild(Tester):
session = self.patient_exclusive_cql_connection(node1)
session.execute("CREATE KEYSPACE ks1 WITH replication = {'class':'SimpleStrategy', 'replication_factor':2};")
- with pytest.raises(ToolError, message='Unable to find sufficient sources for streaming range'):
+ with pytest.raises(ToolError):
node1.nodetool('rebuild -ks ks1 -ts (%s,%s] -s %s' % (node3_token, node1_token, node3_address))
+ pytest.fail("should not find sufficient sources")
@since('3.10')
@pytest.mark.no_vnodes
diff --git a/requirements.txt b/requirements.txt
index d7c396a9..38c13732 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -15,7 +15,7 @@ docopt
enum34
flaky
mock
-pytest==3.6.4
+pytest>=6.5.0
pytest-timeout==1.4.2
pytest-repeat
parse
diff --git a/tools/misc.py b/tools/misc.py
index 542a889a..2f43d9df 100644
--- a/tools/misc.py
+++ b/tools/misc.py
@@ -5,7 +5,10 @@ import hashlib
import logging
import pytest
-from collections import Mapping
+try:
+ from collections.abc import Mapping
+except ImportError:
+ from collections import Mapping
from ccmlib.node import Node
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
[cassandra-dtest] 02/02: Fix logging in ttl test
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-dtest.git
commit ba6a2448c3cc1765add601e4d1ac500a0a75d0bc
Author: Brandon Williams <br...@apache.org>
AuthorDate: Tue Jan 17 15:17:53 2023 -0600
Fix logging in ttl test
Patch by brandonwilliams; reviewed by bereng for CASSANDRA-18121
---
ttl_test.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ttl_test.py b/ttl_test.py
index 7416e9c3..96552de2 100644
--- a/ttl_test.py
+++ b/ttl_test.py
@@ -388,7 +388,7 @@ class TestTTL(Tester):
pytest.fail("should throw InvalidRequest")
if self.cluster.version() >= '3.0': # client warn only on 3.0+
if policy == 'CAP':
- logger.debug("Warning is {}", result.warnings[0])
+ logger.debug("Warning is {}".format(result.warnings[0]))
assert 'exceeds maximum supported expiration' in result.warnings[0], 'Warning not found'
else:
assert not result.warnings, "There should be no warnings"
@@ -591,7 +591,7 @@ class TestRecoverNegativeExpirationDate(TestHelper):
base_dir = os.path.dirname(os.path.abspath(__file__))
corrupt_sstable_dir = os.path.join(base_dir, 'sstables', 'ttl_test', version)
table_dir = self.get_table_paths('ttl_table')[0]
- logger.debug("Copying sstables from {} into {}", corrupt_sstable_dir, table_dir)
+ logger.debug("Copying sstables from {} into {}".format(corrupt_sstable_dir, table_dir))
copytree(corrupt_sstable_dir, table_dir)
logger.debug("Load corrupted sstable")
@@ -609,7 +609,7 @@ class TestRecoverNegativeExpirationDate(TestHelper):
reinsert_overflowed_ttl=True,
no_validate=True)
- logger.debug("Executed offline scrub on {}", str(scrubbed_sstables))
+ logger.debug("Executed offline scrub on {}".format(str(scrubbed_sstables)))
logger.debug("Starting node again")
self.cluster.start()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org