-
Notifications
You must be signed in to change notification settings - Fork 45
Adding tests for analytics-header-filter policy #761
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds a Gherkin integration feature exercising the Analytics Header Filter policy, a comprehensive Go unit test suite for header parsing and OnRequest/OnResponse behavior, and registers the new feature in the BDD test suite. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
7fa371c to
0727436
Compare
6588961 to
53477bd
Compare
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@gateway/it/features/analytics-header-filter.feature`:
- Around line 101-109: The readiness check uses the wrong endpoint: replace the
Gherkin step that waits for
"http://localhost:8080/analytics-response/v1.0/headers" with the corresponding
analytics-request readiness URL so it matches the scenario that posts to
"http://localhost:8080/analytics-request/v1.0/data"; update the step text (the
"I wait for the endpoint ..." line) to point to the analytics-request route and
ensure it uses the supported readiness method for that route so the wait aligns
with the POST target.
| Then the response should be successful | ||
| And the response should be valid JSON | ||
| And the JSON response field "status" should be "success" | ||
| And I wait for the endpoint "http://localhost:8080/analytics-response/v1.0/headers" to be ready | ||
|
|
||
| When I set header "Content-Type" to "application/json" | ||
| And I set header "User-Agent" to "test-client" | ||
| And I set header "Authorization" to "Bearer secret-token" | ||
| And I send a POST request to "http://localhost:8080/analytics-request/v1.0/data" with body: |
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.
Fix the readiness endpoint mismatch.
Line 104 waits on the analytics-response API, but this scenario deploys the analytics-request API. This will likely fail the readiness check or give a false signal. Update the URL to the correct API endpoint (and ensure the wait step aligns with the supported method for that route).
🛠️ Proposed fix
- And I wait for the endpoint "http://localhost:8080/analytics-response/v1.0/headers" to be ready
+ And I wait for the endpoint "http://localhost:8080/analytics-request/v1.0/data" to be ready📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Then the response should be successful | |
| And the response should be valid JSON | |
| And the JSON response field "status" should be "success" | |
| And I wait for the endpoint "http://localhost:8080/analytics-response/v1.0/headers" to be ready | |
| When I set header "Content-Type" to "application/json" | |
| And I set header "User-Agent" to "test-client" | |
| And I set header "Authorization" to "Bearer secret-token" | |
| And I send a POST request to "http://localhost:8080/analytics-request/v1.0/data" with body: | |
| Then the response should be successful | |
| And the response should be valid JSON | |
| And the JSON response field "status" should be "success" | |
| And I wait for the endpoint "http://localhost:8080/analytics-request/v1.0/data" to be ready | |
| When I set header "Content-Type" to "application/json" | |
| And I set header "User-Agent" to "test-client" | |
| And I set header "Authorization" to "Bearer secret-token" | |
| And I send a POST request to "http://localhost:8080/analytics-request/v1.0/data" with body: |
🤖 Prompt for AI Agents
In `@gateway/it/features/analytics-header-filter.feature` around lines 101 - 109,
The readiness check uses the wrong endpoint: replace the Gherkin step that waits
for "http://localhost:8080/analytics-response/v1.0/headers" with the
corresponding analytics-request readiness URL so it matches the scenario that
posts to "http://localhost:8080/analytics-request/v1.0/data"; update the step
text (the "I wait for the endpoint ..." line) to point to the analytics-request
route and ensure it uses the supported readiness method for that route so the
wait aligns with the POST target.
53477bd to
a7826f0
Compare
Purpose
This PR adds the integration and unit tests for the analytics-header-filter policy
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.