mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 17:10:35 +00:00
[test.py] Add uniqueness to the test name
In CI test always executed with option --repeat=3 that leads to generate 3 test results with the same name. Junit plugin in CI cannot distinguish correctly the difference between these results. In case when we have two passes and one fail, the link to test result will sometimes be redirected to the incorrect one because the test name is the same. To fix this ReportPlugin added that will be responsible to modify the test case name during junit report generation adding to the test name mode and run id. Fixes: https://github.com/scylladb/scylladb/issues/17851 Fixes: https://github.com/scylladb/scylladb/issues/15973
This commit is contained in:
@@ -18,6 +18,8 @@ from cassandra.auth import PlainTextAuthProvider
|
||||
from cassandra.cluster import Cluster, ConsistencyLevel, ExecutionProfile, EXEC_PROFILE_DEFAULT
|
||||
from cassandra.policies import RoundRobinPolicy
|
||||
|
||||
from test.pylib.report_plugin import ReportPlugin
|
||||
|
||||
# Use the util.py library from ../cql-pytest:
|
||||
sys.path.insert(1, sys.path[0] + '/test/cql-pytest')
|
||||
from util import unique_name, new_test_keyspace, keyspace_has_tablets, is_scylla
|
||||
@@ -34,6 +36,10 @@ def pytest_addoption(parser):
|
||||
help='Connect to CQL via an encrypted TLSv1.2 connection')
|
||||
parser.addoption('--api-port', action='store', default='10000',
|
||||
help='server REST API port to connect to')
|
||||
parser.addoption('--mode', action='store', required=True,
|
||||
help='Scylla build mode. Tests can use it to adjust their behavior.')
|
||||
parser.addoption('--run_id', action='store', default=1,
|
||||
help='Run id for the test run')
|
||||
|
||||
class RestApiSession:
|
||||
def __init__(self, host, port):
|
||||
@@ -156,3 +162,7 @@ def test_keyspace(cql, this_dc):
|
||||
cql.execute("CREATE KEYSPACE " + name + " WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', '" + this_dc + "' : 1 }")
|
||||
yield name
|
||||
cql.execute("DROP KEYSPACE " + name)
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
config.pluginmanager.register(ReportPlugin())
|
||||
|
||||
Reference in New Issue
Block a user