|
1 | 1 | package datadog.trace.api |
2 | 2 |
|
| 3 | +import static datadog.trace.api.config.GeneralConfig.EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED |
| 4 | + |
3 | 5 | import datadog.trace.api.env.CapturedEnvironment |
4 | 6 | import datadog.trace.test.util.DDSpecification |
5 | | - |
6 | 7 | import java.nio.file.Paths |
7 | 8 |
|
8 | | -import static datadog.trace.api.config.GeneralConfig.EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED |
9 | | - |
10 | 9 | class ProcessTagsForkedTest extends DDSpecification { |
11 | 10 |
|
12 | 11 | def originalProcessInfo |
@@ -129,4 +128,52 @@ class ProcessTagsForkedTest extends DDSpecification { |
129 | 128 | assert ProcessTags.tagsAsStringList[0] == "0test:value" |
130 | 129 | assert ProcessTags.tagsAsUTF8ByteStringList[0].toString() == "0test:value" |
131 | 130 | } |
| 131 | +
|
| 132 | + def 'process tag value normalization'() { |
| 133 | + setup: |
| 134 | + ProcessTags.reset() |
| 135 | + ProcessTags.addTag("test", testValue) |
| 136 | + expect: |
| 137 | + assert ProcessTags.tagsAsStringList != null |
| 138 | + assert ProcessTags.tagsAsStringList.find { it.startsWith("test:") } == "test:${expectedValue}" |
| 139 | +
|
| 140 | + where: |
| 141 | + testValue | expectedValue |
| 142 | + "#test_starting_hash" | "test_starting_hash" |
| 143 | + "TestCAPSandSuch" | "testcapsandsuch" |
| 144 | + "Test Conversion Of Weird !@#\$%^&**() Characters" | "test_conversion_of_weird_characters" |
| 145 | + "\$#weird_starting" | "weird_starting" |
| 146 | + "disallowed:c0l0ns" | "disallowed_c0l0ns" |
| 147 | + "1love" | "1love" |
| 148 | + "123456" | "123456" |
| 149 | + "7.0" | "7.0" |
| 150 | + "ünicöde" | "ünicöde" |
| 151 | + "ünicöde:metäl" | "ünicöde_metäl" |
| 152 | + "Data🐨dog🐶 繋がっ⛰てて" | "data_dog_繋がっ_てて" |
| 153 | + " spaces " | "spaces" |
| 154 | + " #hashtag!@#spaces #__<># " | "hashtag_spaces" |
| 155 | + ":testing" | "testing" |
| 156 | + "_foo" | "foo" |
| 157 | + ":::test" | "test" |
| 158 | + "contiguous_____underscores" | "contiguous_underscores" |
| 159 | + "foo_" | "foo" |
| 160 | + "" | "" |
| 161 | + " " | "" |
| 162 | + "ok" | "ok" |
| 163 | + "AlsO:ök" | "also_ök" |
| 164 | + ":still_ok" | "still_ok" |
| 165 | + "___trim" | "trim" |
| 166 | + "fun:ky__tag/1" | "fun_ky_tag/1" |
| 167 | + "fun:ky@tag/2" | "fun_ky_tag/2" |
| 168 | + "fun:ky@@@tag/3" | "fun_ky_tag/3" |
| 169 | + "tag:1/2.3" | "tag_1/2.3" |
| 170 | + "---fun:k####y_ta@#g/1_@@#" | "fun_k_y_ta_g/1" |
| 171 | + "AlsO:œ#@ö))œk" | "also_œ_ö_œk" |
| 172 | + " regulartag " | "regulartag" |
| 173 | + "\u017Fodd_\u017Fcase\u017F" | "\u017Fodd_\u017Fcase\u017F" |
| 174 | + "™Ö™Ö™™Ö™" | "ö_ö_ö" |
| 175 | + "a�" | "a" |
| 176 | + "a��" | "a" |
| 177 | + "a��b" | "a_b" |
| 178 | + } |
132 | 179 | } |
0 commit comments