File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 11import dataclasses
2+ import os
23import time
34import typing
45from xml .etree import ElementTree as ET # noqa: S405
@@ -62,6 +63,11 @@ async def junit_to_spans(
6263 "test.run.id" : run_id ,
6364 }
6465
66+ if "MERGIFY_TEST_JOB_NAME" in os .environ :
67+ resource_attributes ["mergify.test.job.name" ] = os .environ [
68+ "MERGIFY_TEST_JOB_NAME"
69+ ]
70+
6571 if (job_name := detector .get_job_name ()) is not None :
6672 resource_attributes [cicd_attributes .CICD_PIPELINE_TASK_NAME ] = job_name
6773
Original file line number Diff line number Diff line change 44
55import anys
66import opentelemetry .trace .span
7+ import pytest
78
89from mergify_cli .ci import detector
910from mergify_cli .ci import junit
@@ -36,7 +37,9 @@ async def test_parse(
3637 _get_cicd_pipeline_run_attempt : mock .Mock ,
3738 _get_head_sha : mock .Mock ,
3839 _get_head_ref_name : mock .Mock ,
40+ monkeypatch : pytest .MonkeyPatch ,
3941) -> None :
42+ monkeypatch .setenv ("MERGIFY_TEST_JOB_NAME" , "foobar" )
4043 filename = pathlib .Path (__file__ ).parent / "junit_example.xml"
4144 run_id = (32312 ).to_bytes (8 , "big" ).hex ()
4245 spans = await junit .junit_to_spans (
@@ -62,6 +65,7 @@ async def test_parse(
6265 "telemetry.sdk.language" : "python" ,
6366 "telemetry.sdk.name" : "opentelemetry" ,
6467 "telemetry.sdk.version" : anys .ANY_STR ,
68+ "mergify.test.job.name" : "foobar" ,
6569 }
6670 assert dictified_spans == [
6771 {
You can’t perform that action at this time.
0 commit comments