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):
3434
3535
3636async def junit_to_spans (
37- trace_id : int ,
3837 xml_content : bytes ,
3938 test_language : str | None = None ,
4039 test_framework : str | None = None ,
@@ -82,6 +81,8 @@ async def junit_to_spans(
8281
8382 resource = resources .Resource .create (resource_attributes )
8483
84+ trace_id = ID_GENERATOR .generate_trace_id ()
85+
8586 for testsuite in testsuites :
8687 min_start_time = now
8788 suite_name = testsuite .get ("name" , "unnamed testsuite" )
Original file line number Diff line number Diff line change @@ -57,9 +57,9 @@ def _upload(
5757
5858def connect_traces (spans : list [ReadableSpan ]) -> None :
5959 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
6161 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 } " ,
6363 soft_wrap = True ,
6464 )
6565
@@ -74,13 +74,10 @@ async def upload( # noqa: PLR0913, PLR0917
7474) -> None :
7575 spans = []
7676
77- trace_id = junit .ID_GENERATOR .generate_trace_id ()
78-
7977 for filename in files :
8078 try :
8179 spans .extend (
8280 await junit .junit_to_spans (
83- trace_id ,
8481 pathlib .Path (filename ).read_bytes (),
8582 test_language = test_language ,
8683 test_framework = test_framework ,
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ async def test_parse(
2323) -> None :
2424 filename = pathlib .Path (__file__ ).parent / "junit_example.xml"
2525 spans = await junit .junit_to_spans (
26- 123 ,
2726 filename .read_bytes (),
2827 "python" ,
2928 "unittest" ,
Original file line number Diff line number Diff line change @@ -61,11 +61,13 @@ async def test_junit_upload(
6161
6262 captured = capsys .readouterr ()
6363 if env ["GITHUB_ACTIONS" ] == "true" :
64- assert re .search (
65- r"^::notice title=Mergify CI::MERGIFY_TRACE_ID= \d+" ,
64+ matched = re .search (
65+ r"^::notice title=Mergify CI::MERGIFY_TEST_ROOT_SPAN_ID=( \d+) " ,
6666 captured .out ,
6767 re .MULTILINE ,
6868 )
69+ assert matched is not None
70+ assert int (matched .group (1 )) > 0
6971 else :
7072 assert "🎉 File(s) uploaded" in captured .out
7173
You can’t perform that action at this time.
0 commit comments