apalis-dev / apalis-dev/chirpy

feat (resp): Add integration tests for resp

未关闭
#4 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
4
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

# 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: `HELLO` → `PUSH` → `END`
- [ ] Consumer workflow: `HELLO` → `FETCH` → `ACK` → `END`
- [ ] Consumer failure workflow: `HELLO` → `FETCH` → `FAIL` → `END`

### 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)

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。