File tree Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,6 @@ class InvalidJunitXMLError(Exception):
34
34
35
35
36
36
async def junit_to_spans (
37
- trace_id : int ,
38
37
xml_content : bytes ,
39
38
test_language : str | None = None ,
40
39
test_framework : str | None = None ,
@@ -88,6 +87,8 @@ async def junit_to_spans(
88
87
89
88
resource = resources .Resource .create (resource_attributes )
90
89
90
+ trace_id = ID_GENERATOR .generate_trace_id ()
91
+
91
92
for testsuite in testsuites :
92
93
min_start_time = now
93
94
suite_name = testsuite .get ("name" , "unnamed testsuite" )
Original file line number Diff line number Diff line change @@ -57,9 +57,9 @@ def upload_spans(
57
57
58
58
def connect_traces (spans : list [ReadableSpan ]) -> None :
59
59
if detector .get_ci_provider () == "github_actions" and spans :
60
- trace_id = spans [0 ].context .trace_id
60
+ root_span_id = spans [0 ].context .span_id
61
61
console .print (
62
- f"::notice title=Mergify CI::MERGIFY_TRACE_ID= { trace_id } " ,
62
+ f"::notice title=Mergify CI::MERGIFY_TEST_ROOT_SPAN_ID= { root_span_id } " ,
63
63
soft_wrap = True ,
64
64
)
65
65
@@ -74,13 +74,10 @@ async def upload( # noqa: PLR0913, PLR0917
74
74
) -> None :
75
75
spans = []
76
76
77
- trace_id = junit .ID_GENERATOR .generate_trace_id ()
78
-
79
77
for filename in files :
80
78
try :
81
79
spans .extend (
82
80
await junit .junit_to_spans (
83
- trace_id ,
84
81
pathlib .Path (filename ).read_bytes (),
85
82
test_language = test_language ,
86
83
test_framework = test_framework ,
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ async def test_parse(
27
27
) -> None :
28
28
filename = pathlib .Path (__file__ ).parent / "junit_example.xml"
29
29
spans = await junit .junit_to_spans (
30
- 123 ,
31
30
filename .read_bytes (),
32
31
"python" ,
33
32
"unittest" ,
Original file line number Diff line number Diff line change @@ -63,11 +63,13 @@ async def test_junit_upload(
63
63
64
64
captured = capsys .readouterr ()
65
65
if env ["GITHUB_ACTIONS" ] == "true" :
66
- assert re .search (
67
- r"^::notice title=Mergify CI::MERGIFY_TRACE_ID= \d+" ,
66
+ matched = re .search (
67
+ r"^::notice title=Mergify CI::MERGIFY_TEST_ROOT_SPAN_ID=( \d+) " ,
68
68
captured .out ,
69
69
re .MULTILINE ,
70
70
)
71
+ assert matched is not None
72
+ assert int (matched .group (1 )) > 0
71
73
72
74
assert "🎉 File(s) uploaded" in captured .out
73
75
You can’t perform that action at this time.
0 commit comments