|
8 | 8 | from ddtrace.internal.process_tags import ENTRYPOINT_NAME_TAG |
9 | 9 | from ddtrace.internal.process_tags import ENTRYPOINT_TYPE_TAG |
10 | 10 | from ddtrace.internal.process_tags import ENTRYPOINT_WORKDIR_TAG |
| 11 | +from ddtrace.internal.process_tags import _compute_process_tag |
11 | 12 | from ddtrace.internal.process_tags import normalize_tag_value |
12 | 13 | from ddtrace.internal.settings.process_tags import process_tags_config as config |
13 | 14 | from tests.subprocesstest import run_in_subprocess |
|
65 | 66 | ( |
66 | 67 | "A0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" |
67 | 68 | " 00000000000", |
68 | | - "a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" |
69 | | - "_0", |
| 69 | + "a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000_0", |
70 | 70 | ), |
71 | 71 | ], |
72 | 72 | ) |
73 | 73 | def test_normalize_tag(input_tag, expected): |
74 | 74 | assert normalize_tag_value(input_tag) == expected |
75 | 75 |
|
76 | 76 |
|
| 77 | +@pytest.mark.parametrize( |
| 78 | + "excluded_value", |
| 79 | + ["/", "\\", "bin", "", None], |
| 80 | +) |
| 81 | +def test_compute_process_tag_excluded_values(excluded_value): |
| 82 | + result = _compute_process_tag("test_key", lambda: excluded_value) |
| 83 | + assert result is None |
| 84 | + |
| 85 | + |
77 | 86 | class TestProcessTags(TracerTestCase): |
78 | 87 | def setUp(self): |
79 | 88 | super(TestProcessTags, self).setUp() |
@@ -134,17 +143,12 @@ def test_process_tags_error(self): |
134 | 143 | assert "failed to get process tag" in call_args1[0], ( |
135 | 144 | f"Expected error message not found. Got: {call_args1[0]}" |
136 | 145 | ) |
137 | | - assert call_args1[1] == "entrypoint.basedir", ( |
138 | | - f"Expected tag key not found. Got: {call_args1[1]}" |
139 | | - ) |
| 146 | + assert call_args1[1] == "entrypoint.basedir", f"Expected tag key not found. Got: {call_args1[1]}" |
140 | 147 |
|
141 | 148 | assert "failed to get process tag" in call_args2[0], ( |
142 | 149 | f"Expected error message not found. Got: {call_args2[0]}" |
143 | 150 | ) |
144 | | - assert call_args2[1] == "entrypoint.name", ( |
145 | | - f"Expected tag key not found. Got: {call_args2[1]}" |
146 | | - ) |
147 | | - |
| 151 | + assert call_args2[1] == "entrypoint.name", f"Expected tag key not found. Got: {call_args2[1]}" |
148 | 152 |
|
149 | 153 | @pytest.mark.snapshot |
150 | 154 | @run_in_subprocess(env_overrides=dict(DD_TRACE_PARTIAL_FLUSH_ENABLED="true", DD_TRACE_PARTIAL_FLUSH_MIN_SPANS="2")) |
|
0 commit comments