Skip to content

node: add tests for httpService lifecycle and all servers#3487

Open
VanshSahay wants to merge 4 commits intoNethermindEth:mainfrom
VanshSahay:feat/http_tests
Open

node: add tests for httpService lifecycle and all servers#3487
VanshSahay wants to merge 4 commits intoNethermindEth:mainfrom
VanshSahay:feat/http_tests

Conversation

@VanshSahay
Copy link

Picks up where #1211 left off (which was closed for inactivity/incomplete coverage).

The gap has been sitting open since the regression caught in #1179 node/http.go wires up several servers but there were no tests verifying any of them actually boot and serve correctly. This adds that coverage. Rather than testing RPC methods (that's already handled in the rpc package), the tests focus on what this layer actually owns: can each server start, respond to at least one request, and shut down cleanly. Took inspiration from the old node/http/server_test.go that used to exist before the refactor.

  • httpService starts and shuts down gracefully on context cancellation
  • HTTP JSON-RPC server responds to valid requests and handles bad content-type without crashing (the class of bug from Fix grpc server #1179)
  • WebSocket server completes the upgrade handshake (101 Switching Protocols)
  • Metrics server serves /metrics with the right content-type
  • pprof server serves /debug/pprof/
  • Graceful shutdown under concurrent load

Each test gets ephemeral OS-assigned ports so nothing conflicts when run in parallel.
Closes #1180

@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 81.25000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.31%. Comparing base (5e12792) to head (b5d56a7).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
node/http.go 80.00% 2 Missing ⚠️
node/node.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3487      +/-   ##
==========================================
- Coverage   75.40%   74.31%   -1.10%     
==========================================
  Files         385      385              
  Lines       34908    34976      +68     
==========================================
- Hits        26323    25993     -330     
- Misses       6734     6789      +55     
- Partials     1851     2194     +343     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@VanshSahay VanshSahay requested a review from rodrodros March 18, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for node/http.go

2 participants