Skip to content

Task 3-2: Integration Test - Multi-Match prizeIds Flow

Phase: 3 - Testing Priority: Medium Depends on: task-1-1 Reference: docs/BountyHunter-Backend/details/feature-matching-matchmaking/SPEC.md

Background

Test prize_ids array mode (PVP_MULTI_MATCH) bao gồm routing đúng queue và validation consistency.

Test scenarios

Queue routing

  • [ ] prize_ids chứa streaming prize → route qua queue-prize-allocation-PRIZE_FOR_STREAMER
  • Verify bằng JMX hoặc log: message xuất hiện trong đúng queue
  • [ ] prize_ids chỉ non-streaming prizes → route qua queue-prize-allocation-PRIZE
  • Verify tương tự

Validation (liên quan task-1-1 - error reason codes)

  • [ ] prize_ids với mixed allocation types (STREAMING + non-STREAMING) → VALIDATE_GAME event với reason MatchingReasonCode.INVALID_PRIZE_ALLOCATION_TYPE
  • [ ] prize_ids với invalid prizeId (không tồn tại trong DB) → VALIDATE_GAME event với reason MatchingReasonCode.INVALID_PRIZE_IDS
  • [ ] Verify: reason codes khớp với constants định nghĩa trong task-1-1

Opponent pool multi-match

  • [ ] JOIN_OPPONENT_POOL với prizeIds array → join pool cho tất cả prizes
  • [ ] Match found → room được tạo với đầy đủ prizes từ prizeIds
  • [ ] Verify room record có prizes list đầy đủ

Backward compat

  • [ ] Request với prize_id (không có prize_ids) vẫn hoạt động đúng (single mode)
  • [ ] Request với cả prize_idprize_ids → xác định behavior (document expected priority)

Verification / Acceptance Criteria

  • [ ] Queue routing đúng cho streaming vs non-streaming prize types
  • [ ] Validation errors có đúng reason code theo MatchingReasonCode.*
  • [ ] Multi-match room được tạo với đầy đủ prizes
  • [ ] Backward compat với prize_id single mode không bị break

Files to Modify

  • Test files trong websocket/src/test/ hoặc integration test module