Skip to content

feat (resp): Add integration tests for resp #4

Description

@geofmureithi

Integration Testing for RESP Server

Overview

We need comprehensive integration tests for the RESP protocol server implementation to ensure all protocol commands work correctly in real-world scenarios with actual TCP connections.

Background

Currently, the RESP server has unit tests, but we lack integration tests that validate the full client-server interaction over TCP. Integration tests will help us catch issues related to:

  • Network communication and connection handling
  • Protocol serialization/deserialization in real scenarios
  • State management across multiple requests
  • Concurrent client handling
  • Edge cases and error conditions

Goals

Create a robust integration test suite that:

  1. Tests all RESP protocol commands end-to-end
  2. Validates multi-client scenarios
  3. Ensures proper connection lifecycle management
  4. Verifies error handling and edge cases
  5. Tests worker state transitions (Consumer → Quiet → Terminating)

Test Scenarios to Cover

Basic Protocol Flow

  • Server startup and greeting (HI command)
  • Client authentication (with and without password)
  • Producer workflow: HELLOPUSHEND
  • Consumer workflow: HELLOFETCHACKEND
  • Consumer failure workflow: HELLOFETCHFAILEND

Job Lifecycle

  • Push job and verify it's queued
  • Fetch job from default queue
  • Fetch job from specific named queues
  • Fetch with multiple queue priority
  • ACK job and verify removal
  • FAIL job and verify retry scheduling
  • Job with retry limit exhaustion (moves to dead)
  • Scheduled jobs (with at field)
  • Job reservation timeout and re-queueing

Worker Management

  • Worker registration via HELLO
  • Worker heartbeat (BEAT) responses
  • Worker state transitions (quiet, terminate)
  • Multiple workers on same queue
  • Worker disconnection cleanup

Concurrency & Race Conditions

  • Multiple producers pushing jobs simultaneously
  • Multiple consumers fetching from same queue
  • Job reservation conflicts
  • Concurrent ACK/FAIL operations
  • Worker registration race conditions

Error Handling

  • Invalid JSON in commands
  • Missing required fields
  • Commands in wrong state (e.g., FETCH before HELLO)
  • Invalid job IDs in ACK/FAIL
  • Protocol version mismatch
  • Authentication failures
  • Malformed RESP responses

Administrative Commands

  • INFO command and response parsing
  • FLUSH command clears all jobs
  • Graceful connection termination with END

Edge Cases

  • Empty queue fetch (should return null bulk string)
  • Job with no retry (retry: 0)
  • Job with infinite retry (retry: -1)
  • Very long job arguments
  • Unicode/special characters in job data
  • Rapid connect/disconnect cycles
  • Server under load (many concurrent connections)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions