File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,7 +37,15 @@ def test_truncation(self):
3737
3838 assert int (metrics ["_dd.appsec.truncated.string_length" ]) == 5000
3939 assert int (metrics ["_dd.appsec.truncated.container_size" ]) == 300
40- assert int (metrics ["_dd.appsec.truncated.container_depth" ]) == 20
40+
41+ # Because finding the actual depth is non-trivial and the definition of depth could differ between libraries
42+ # depending on if the addresses are counted or not, we are not asserting the exact value here.
43+ # Max value of 28 is made of:
44+ # * 25 "a" from create_nested_object()
45+ # * 1 "deepObject" from setup_truncation()
46+ # * 1 "server.request.body" address
47+ # * 1 of leeway depending on how leafs of the tree are counted
48+ assert 20 <= int (metrics ["_dd.appsec.truncated.container_depth" ]) <= 28
4149
4250 waf_requests_series = find_series ("generate-metrics" , "appsec" , ["waf.requests" ])
4351 has_input_truncated = any ("input_truncated:true" in series ["tags" ] for series in waf_requests_series )
You can’t perform that action at this time.
0 commit comments