[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:
Andrei Chekun
2024-06-11 14:58:03 +02:00
parent 93b9b85c12
commit 8d1d206aff
9 changed files with 73 additions and 6 deletions

View File

@@ -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())