[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

@@ -21,6 +21,9 @@ import tempfile
import time
import random
import sys
sys.path.insert(1, sys.path[0] + '/../..')
from test.pylib.report_plugin import ReportPlugin
from util import unique_name, new_test_keyspace, keyspace_has_tablets, cql_session, local_process_id, is_scylla
@@ -42,6 +45,10 @@ def pytest_addoption(parser):
# presence.
parser.addoption('--omit-scylla-output', action='store_true',
help='Omit scylla\'s output from the test output')
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')
# "cql" fixture: set up client object for communicating with the CQL API.
# The host/port combination of the server are determined by the --host and
@@ -262,3 +269,7 @@ def has_tablets(cql):
def skip_without_tablets(scylla_only, has_tablets):
if not has_tablets:
pytest.skip("Test needs tablets experimental feature on")
def pytest_configure(config):
config.pluginmanager.register(ReportPlugin())