[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

@@ -14,6 +14,7 @@ import boto3
import requests
import re
from test.pylib.report_plugin import ReportPlugin
from test.alternator.util import create_test_table, is_aws, scylla_log
from urllib.parse import urlparse
from functools import cache
@@ -49,8 +50,13 @@ def pytest_addoption(parser):
help='Omit scylla\'s output from the test output')
parser.addoption('--host', action='store', default='localhost',
help='Scylla server host 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')
def pytest_configure(config):
config.addinivalue_line("markers", "veryslow: mark test as very slow to run")
config.pluginmanager.register(ReportPlugin())
def pytest_collection_modifyitems(config, items):
if config.getoption("--runveryslow"):