diff --git a/tests/parametric/test_headers_baggage.py b/tests/parametric/test_headers_baggage.py index 04d88b3186..c5dd901675 100644 --- a/tests/parametric/test_headers_baggage.py +++ b/tests/parametric/test_headers_baggage.py @@ -1,6 +1,7 @@ from operator import le from py import test from requests import head # type: ignore +from utils._decorators import irrelevant from utils.parametric.spec.trace import SAMPLING_PRIORITY_KEY, ORIGIN from utils.parametric.spec.trace import span_has_no_parent from utils.parametric.spec.trace import find_only_span @@ -56,6 +57,10 @@ def test_headers_baggage_only_D002(self, test_library): assert "baggage" in headers.keys() assert headers["baggage"] == "foo=bar" + @irrelevant( + context.library in ("cpp", "goland", "java", "ruby", "php"), + reason="The current default behaviour matches the future baggage disabled behaviour, so we can't activate this test without causing a false easy win", + ) @disable_baggage() def test_baggage_disable_settings_D003(self, test_agent, test_library): """Ensure that baggage headers are not injected when baggage is disabled and does not interfere with other headers.""" @@ -125,6 +130,10 @@ def test_baggage_set_D006(self, test_library): assert span.get_baggage("userId") == "Amélie" assert span.get_baggage("serverNode") == "DF 28" + @irrelevant( + context.library in ("cpp", "goland", "java", "ruby", "php"), + reason="The current default behaviour matches the future baggage disabled behaviour, so we can't activate this test without causing a false easy win", + ) @disable_baggage() def test_baggage_set_disabled_D007(self, test_library): """Ensure that baggage headers are not injected when baggage is disabled.""" @@ -178,8 +187,19 @@ def test_baggage_remove_all_D011(self, test_library): span.remove_all_baggage() assert span.get_all_baggage() == {} - def test_baggage_malformed_headers_D012(self, test_library, test_agent): + def _assert_valid_baggage(self, test_library): + """ + Helper function to confirm that a valid baggage header is set + when calling dd_make_child_span_and_get_headers. + """ + with test_library: + headers = test_library.dd_make_child_span_and_get_headers([["baggage", "foo=valid"]]) + assert "baggage" in headers.keys() + + def test_baggage_malformed_headers_D012(self, test_library): """Ensure that malformed baggage headers are handled properly. Unable to use get_baggage functions because it does not return anything""" + Test_Headers_Baggage._assert_valid_baggage(self, test_library) + with test_library: headers = test_library.dd_make_child_span_and_get_headers( [["baggage", "no-equal-sign,foo=gets-dropped-because-previous-pair-is-malformed"]], @@ -189,18 +209,24 @@ def test_baggage_malformed_headers_D012(self, test_library, test_agent): def test_baggage_malformed_headers_D013(self, test_library): """Ensure that malformed baggage headers are handled properly. Unable to use get_baggage functions because it does not return anything""" + Test_Headers_Baggage._assert_valid_baggage(self, test_library) + with test_library: headers = test_library.dd_make_child_span_and_get_headers([["baggage", "=no-key"]]) assert "baggage" not in headers.keys() def test_baggage_malformed_headers_D014(self, test_library): + Test_Headers_Baggage._assert_valid_baggage(self, test_library) + with test_library: headers = test_library.dd_make_child_span_and_get_headers([["baggage", "no-value="]]) assert "baggage" not in headers.keys() def test_baggage_malformed_headers_D015(self, test_library): + Test_Headers_Baggage._assert_valid_baggage(self, test_library) + with test_library: headers = test_library.dd_make_child_span_and_get_headers( [["baggage", "foo=gets-dropped-because-subsequent-pair-is-malformed,="]],