Skip to content

Conversation

@jmg-duarte
Copy link
Contributor

Description

Add e2e tests to verify HTTP behavior consistency before the warp-to-axum migration.

Changes

  • Add cors.rs - Tests for CORS preflight requests and CORS headers on error responses
  • Add missing_endpoints.rs - Tests that invalid/nonexistent routes return 404
  • Add malformed_requests.rs - Tests for:
    • Malformed path parameters (OrderUid, Address, B256, AuctionId) return 404
    • Malformed request bodies (invalid JSON, empty body, missing fields, wrong types) return 400
    • Error response format verification (deserialization errors return plain text, business logic errors return JSON with errorType and description)

How to test

Run the new e2e tests:

cargo nextest run -p e2e cors --run-ignored ignored-only --test-threads=1 --failure-output final
cargo nextest run -p e2e missing_endpoints --run-ignored ignored-only --test-threads=1 --failure-output final
cargo nextest run -p e2e malformed_requests --run-ignored ignored-only --test-threads=1 --failure-output final

@jmg-duarte jmg-duarte requested a review from a team as a code owner January 20, 2026 15:29
@jmg-duarte jmg-duarte force-pushed the jmgd/axum/test-others branch from e88e78f to e858b62 Compare January 20, 2026 15:30
@jmg-duarte jmg-duarte marked this pull request as draft January 21, 2026 14:25
@jmg-duarte jmg-duarte changed the base branch from jmgd/axum/test-e2e to main January 21, 2026 14:57
Add tests to verify HTTP behavior before warp-to-axum migration:

- cors.rs: CORS preflight and headers on error responses
- missing_endpoints.rs: 404 for invalid/nonexistent routes
- malformed_requests.rs: Path parameter validation (returns 404),
  request body validation (returns 400), and error response format
@jmg-duarte jmg-duarte force-pushed the jmgd/axum/test-others branch from bb7c76c to d36402f Compare January 21, 2026 15:27
@jmg-duarte jmg-duarte marked this pull request as ready for review January 21, 2026 15:27
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds end-to-end tests for HTTP behavior consistency. The assertions in the CORS preflight tests are not sufficiently strict, as they use substring checks on comma-separated header values. This can result in false positives. I have suggested replacing these with more robust checks that parse the header values and verify exact matches to ensure test reliability.

Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright to me. Judging by the tests a reasonable rule of thumb seems to be:
can't find path or parse the URL components => 404
URL parses find but body is malformed => 400

@jmg-duarte
Copy link
Contributor Author

Looks alright to me. Judging by the tests a reasonable rule of thumb seems to be:
can't find path or parse the URL components => 404
URL parses find but body is malformed => 400

Yeah because a malformed path is basically a non-existing one, I think it makes more sense like this

@jmg-duarte jmg-duarte added this pull request to the merge queue Jan 22, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 22, 2026
@jmg-duarte jmg-duarte added this pull request to the merge queue Jan 22, 2026
Merged via the queue into main with commit bc207b9 Jan 22, 2026
19 checks passed
@jmg-duarte jmg-duarte deleted the jmgd/axum/test-others branch January 22, 2026 11:59
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants