Skip to content

Commit ddb39b2

Browse files
Remap egressip test names for Polarion upload
Tests from openshift-tests-private use [sig-networking] classname and SDN_OVN_EgressIP_* naming. After format_test_case_name() these become sig-networking.SDN_OVN_EgressIP_* which JUMP cannot match against Polarion entries, causing "Cannot proceed without xml with tempest results" and dropping all egressip results from reporting. Add a remap step for known private-test suites (egressip_tests) that rewrites names to sig-installer.Suite_openshift_openstack.egressip.* matching the convention used by the main openstack test suites. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 84287d0 commit ddb39b2

1 file changed

Lines changed: 55 additions & 4 deletions

File tree

collection/tools/roles/tools_openshift_tests/scripts/modifyE2ETags.py

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,57 @@
44
import sys
55
import time
66

7+
# Mapping of testsuite names whose tests originate from openshift-tests-private
8+
# and need classname remapped to match the Polarion naming convention used by
9+
# the main openstack test suites (sig-installer.Suite_openshift_openstack.*).
10+
PRIVATE_TEST_SUITES = {
11+
'egressip_tests': 'sig-installer.Suite_openshift_openstack.egressip',
12+
}
13+
14+
715
def format_test_case_name(s):
816
return s.replace(':', '_').replace('/', '_').replace(' ', '_').replace('.', '_').replace('[', '.').replace(']', '.').rstrip('.').replace('..','.').replace('_.','.').replace('._','.')[1::]
917

18+
19+
def remap_private_test_name(tc_name, testsuite_name):
20+
"""Remap openshift-tests-private names to Polarion-compatible format.
21+
22+
Tests from openshift-tests-private use [sig-networking] SDN_OVN_EgressIP_*
23+
naming which JUMP cannot match. Remap to the sig-installer.Suite_openshift_openstack
24+
pattern that has registered Polarion test case entries.
25+
"""
26+
prefix = PRIVATE_TEST_SUITES.get(testsuite_name)
27+
if not prefix:
28+
return None
29+
short_name = format_test_case_name(tc_name)
30+
# Strip the sig-networking (or similar) classname prefix from Ginkgo output
31+
if '.' in short_name:
32+
_, short_name = short_name.split('.', 1)
33+
return f"{prefix}.{short_name}"
34+
35+
36+
# Self-test mode: verify transform logic without processing XML files.
37+
if len(sys.argv) == 2 and sys.argv[1] == '--self-test':
38+
egressip_input = (
39+
'[sig-networking] SDN OVN EgressIP Author:huirwang-ConnectedOnly-Medium-47272-'
40+
'.FdpOvnOvs.Pods will not be affected by the egressIP set on other netnamespace .Serial'
41+
)
42+
result = remap_private_test_name(egressip_input, 'egressip_tests')
43+
assert result.startswith('sig-installer.Suite_openshift_openstack.egressip.SDN_OVN_EgressIP_'), \
44+
f"Unexpected remap result: {result}"
45+
46+
assert remap_private_test_name(egressip_input, 'unknown_suite') is None, \
47+
"Unknown suite should return None"
48+
49+
otp_input = '[OTP][sig-installer] Suite openshift openstack lb Serial test'
50+
otp_result = format_test_case_name(otp_input)
51+
assert otp_result.startswith('OTP.sig-installer'), \
52+
f"OTP prefix not preserved by format_test_case_name: {otp_result}"
53+
54+
print("All self-tests passed.")
55+
sys.exit(0)
56+
1057
# This script modify a given xml report so it can be uploaded to ReportPortal and Polarion.
11-
# third argument. Currently it's used for NetworkPolicy and Conformance tests
1258
# @arg1: input xml file.
1359
# @arg2: output xml file.
1460
# @arg3: Tests to include
@@ -48,9 +94,14 @@ def format_test_case_name(s):
4894
print('TestCase removed from input XML:', tc_name)
4995
ts.remove(tc)
5096
else:
51-
new_tc_name = format_test_case_name(tc_name)
52-
if new_tc_name.startswith('OTP.'):
53-
new_tc_name = new_tc_name[4:]
97+
remapped = remap_private_test_name(tc_name, testsuite_name)
98+
if remapped:
99+
new_tc_name = remapped
100+
else:
101+
new_tc_name = format_test_case_name(tc_name)
102+
if new_tc_name.startswith('OTP.'):
103+
new_tc_name = new_tc_name[4:]
104+
54105
if '.' in new_tc_name:
55106
tc_classname, tc_name_rest = new_tc_name.split('.', 1)
56107
tc.set('classname', tc_classname)

0 commit comments

Comments
 (0)