dice icon indicating copy to clipboard operation
dice copied to clipboard

Add Integration Tests for HTTP Server Functionality

Open Shikha-code36 opened this issue 1 year ago • 0 comments

This pull request adds integration tests for the HTTP server implementation in DiceDB. The new tests cover the following areas:

  1. HTTP GET request handling: Verifies that the server can properly receive and respond to GET requests.
  2. HTTP POST request handling: Tests the server's ability to process commands (such as SET) sent via POST requests.
  3. Health check endpoint: Ensures that the /health endpoint is working correctly, allowing for easy monitoring of the server's status.

These tests are crucial for ensuring the reliability and correctness of our HTTP server implementation. They will help catch any regressions in functionality as we continue to develop and improve DiceDB.

Changes made:

  • Added a new file http_server_test.go in the integration_tests/server directory.
  • Implemented three test cases: HTTPGetRequest, HTTPPostRequest, and HealthCheck.
  • Utilized the existing TestServerOptions and RunTestServer functions to set up the test environment.

To run these tests:

  1. Navigate to the project root
  2. Run go test -v ./integration_tests/server

These tests currently pass with the existing implementation and will serve as a safeguard against future changes that might inadvertently break our HTTP server functionality.

Reviewers, please pay attention to:

  • The correctness of the HTTP requests being made
  • The assertions checking the server's responses
  • Any additional test cases you think should be included

Future work:

  • Expand test coverage to include more complex command scenarios
  • Add performance benchmarks for the HTTP server

Shikha-code36 avatar Sep 17 '24 11:09 Shikha-code36