-
Notifications
You must be signed in to change notification settings - Fork 399
[INCIDENT-46145] Rewrite security response tests #5083
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
296e158 to
666b5a3
Compare
BenchmarksBenchmark execution time: 2025-11-24 19:39:17 Comparing candidate commit e63a425 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 44 metrics, 2 unstable metrics. |
666b5a3 to
6a641c0
Compare
y9v
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job! It's much more readable now
lloeki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It failed on 3.4 though.
Very odd that this doesn't make the merge button red so I'm putting a request changes to prevent an accidental merge.
Failures:
1) Datadog::AppSec::Response.from_interrupt_params .body when Accept header value is application/json returns default json template with security response ID
Failure/Error:
expect(response.body[0]).to include(
/{"errors":.*,"security_response_id":"00000000-0000-0000-0000-000000000000".*}/
)
TypeError:
no implicit conversion of Regexp into String
# ./spec/datadog/appsec/response_spec.rb:125:in 'block (5 levels) in <top (required)>'
# ./spec/spec_helper.rb:274:in 'block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:154:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/rspec-wait-0.0.10/lib/rspec/wait.rb:47:in 'block (2 levels) in <top (required)>'
# ./spec/support/execute_in_fork.rb:32:in 'ForkableExample#run'
2) Datadog::AppSec::Response.from_interrupt_params .body when Accept header value is text/html returns HTML template with security response ID
Failure/Error:
expect(response.body[0]).to include(
/.*<!DOCTYPE html>\n.*<p class="security-response-id">.*: 00000000-0000-0000-0000-000000000000/m
)
TypeError:
no implicit conversion of Regexp into String
# ./spec/datadog/appsec/response_spec.rb:111:in 'block (5 levels) in <top (required)>'
# ./spec/spec_helper.rb:274:in 'block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:154:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/rspec-wait-0.0.10/lib/rspec/wait.rb:47:in 'block (2 levels) in <top (required)>'
# ./spec/support/execute_in_fork.rb:32:in 'ForkableExample#run'
3) Datadog::AppSec::Response.from_interrupt_params .body when Accept header value is not supported returns default json template with security response ID
Failure/Error:
expect(response.body[0]).to include(
/{"errors":.*,"security_response_id":"00000000-0000-0000-0000-000000000000".*}/
)
TypeError:
no implicit conversion of Regexp into String
# ./spec/datadog/appsec/response_spec.rb:97:in 'block (5 levels) in <top (required)>'
# ./spec/spec_helper.rb:274:in 'block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:154:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/rspec-wait-0.0.10/lib/rspec/wait.rb:47:in 'block (2 levels) in <top (required)>'
# ./spec/support/execute_in_fork.rb:32:in 'ForkableExample#run'
4) Datadog::AppSec::Response.from_interrupt_params .body when default template is changed to custom returns custom template with security response ID
Failure/Error:
expect(response.body[0]).to include(
/Blocked, that's an ID: 00000000-0000-0000-0000-000000000000/
)
TypeError:
no implicit conversion of Regexp into String
# ./spec/datadog/appsec/response_spec.rb:172:in 'block (5 levels) in <top (required)>'
# ./spec/datadog/appsec/response_spec.rb:159:in 'block (6 levels) in <top (required)>'
# ./spec/datadog/appsec/response_spec.rb:147:in 'block (5 levels) in <top (required)>'
# ./spec/spec_helper.rb:274:in 'block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:154:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/rspec-wait-0.0.10/lib/rspec/wait.rb:47:in 'block (2 levels) in <top (required)>'
# ./spec/support/execute_in_fork.rb:32:in 'ForkableExample#run'
5) Datadog::AppSec::Response.from_interrupt_params .body when Accept header value is text/plain returns default json template with security response ID
Failure/Error:
expect(response.body[0]).to include(
/You've been blocked.*Security Response ID: 00000000-0000-0000-0000-000000000000.*/m
)
TypeError:
no implicit conversion of Regexp into String
# ./spec/datadog/appsec/response_spec.rb:139:in 'block (5 levels) in <top (required)>'
# ./spec/spec_helper.rb:274:in 'block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:154:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/rspec-wait-0.0.10/lib/rspec/wait.rb:47:in 'block (2 levels) in <top (required)>'
# ./spec/support/execute_in_fork.rb:32:in 'ForkableExample#run'
6) Datadog::AppSec::Response.from_interrupt_params when response is a block response returns response with block attributes
Failure/Error:
expect(response.body[0]).to include(
/<p class="security-response-id">.*: 00000000-0000-0000-0000-000000000000/
)
TypeError:
no implicit conversion of Regexp into String
# ./spec/datadog/appsec/response_spec.rb:74:in 'block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:274:in 'block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:154:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/webmock-3.23.1/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'
# /usr/local/bundle/gems/rspec-wait-0.0.10/lib/rspec/wait.rb:47:in 'block (2 levels) in <top (required)>'
# ./spec/support/execute_in_fork.rb:32:in 'ForkableExample#run'
Finished in 1 minute 53.24 seconds (files took 2.64 seconds to load)
5657 examples, 6 failures, 62 pending
6a641c0 to
e63a425
Compare
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage 🔗 Commit SHA: e63a425 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
What does this PR do?
In this PR I've rewritten a bit outdated tests and fix a potential flakiness on JRuby when we write in a file and reconfigure global configuration state with after block in shared example.
Motivation:
Outdated tests have some issues on JRuby on some random occasion. Let's streamline the tests and also reduce flakiness (I hope 🤞🏼)
Change log entry
No.
Additional Notes:
No.
How to test the change?
CI.