Skip to content

Commit 485c09d

Browse files
committed
pr
1 parent 9b670db commit 485c09d

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

dd-java-agent/appsec/src/test/groovy/com/datadog/appsec/gateway/AppSecRequestContextSpecification.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,14 @@ class AppSecRequestContextSpecification extends DDSpecification {
306306

307307
def "test increase and get WafErrors"() {
308308
when:
309-
ctx.increaseWafErrorCode(-3)
310-
ctx.increaseWafErrorCode(-3)
311-
ctx.increaseWafErrorCode(-2)
309+
ctx.increaseWafErrorCode(AppSecRequestContext.DD_WAF_RUN_INTERNAL_ERROR)
310+
ctx.increaseWafErrorCode(AppSecRequestContext.DD_WAF_RUN_INTERNAL_ERROR)
311+
ctx.increaseWafErrorCode(AppSecRequestContext.DD_WAF_RUN_INVALID_OBJECT_ERROR)
312312

313313
then:
314-
ctx.getWafError(-3) == 2
315-
ctx.getWafError(-2) == 1
316-
ctx.getWafError(-1) == 0
314+
ctx.getWafError(AppSecRequestContext.DD_WAF_RUN_INTERNAL_ERROR) == 2
315+
ctx.getWafError(AppSecRequestContext.DD_WAF_RUN_INVALID_OBJECT_ERROR) == 1
316+
ctx.getWafError(AppSecRequestContext.DD_WAF_RUN_INVALID_ARGUMENT_ERROR) == 0
317317
ctx.getWafError(0) == 0
318318
}
319319
}

internal-api/src/test/groovy/datadog/trace/api/telemetry/WafMetricCollectorTest.groovy

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,11 @@ class WafMetricCollectorTest extends DDSpecification {
182182
wafInvalidObjectCode.value == 1
183183
wafInvalidObjectCode.namespace == 'appsec'
184184
wafInvalidObjectCode.metricName == 'waf.error'
185-
wafInvalidObjectCode.tags.toSet() == ['rule_type:sql_injection', 'waf_version:waf_ver1',
186-
'waf_error:'+DD_WAF_RUN_INVALID_OBJECT_ERROR].toSet()
187-
185+
wafInvalidObjectCode.tags.toSet() == [
186+
'rule_type:sql_injection',
187+
'waf_version:waf_ver1',
188+
'waf_error:'+DD_WAF_RUN_INVALID_OBJECT_ERROR
189+
].toSet()
188190
}
189191

190192
def "overflowing WafMetricCollector does not crash"() {
@@ -424,7 +426,7 @@ class WafMetricCollectorTest extends DDSpecification {
424426
'rule_type:command_injection',
425427
'rule_variant:' + ruleType.variant,
426428
'event_rules_version:rules.1',
427-
'waf_error:-3'
429+
'waf_error:' + DD_WAF_RUN_INTERNAL_ERROR
428430
].toSet()
429431

430432
where:

0 commit comments

Comments
 (0)