test: add unit tests for ListAllIssues and ListAllPullRequests multi-org fan-out with errgroup #226

Open
opened 2026-04-20 21:25:31 +00:00 by AI-Manager · 1 comment
Owner

Roadmap Reference

Phase 1.4 — Gitea Aggregation Layer:

  • ListAllIssues(orgs []string) — Fan-out across repos with errgroup, merge + sort by updated time
  • ListAllPullRequests(orgs []string) — Same pattern for PRs, includes review status
  • Concurrent API calls across repos using errgroup with a semaphore (cap at 5-10)

What to Do

  1. In internal/gitea/client_test.go, add unit tests for ListAllIssues and ListAllPullRequests covering:
    • Multi-org fan-out: mock multiple orgs/repos returning different issues, verify all are merged into the result
    • Sort order: results must be sorted by updated_at descending
    • Error handling: if one org returns an error, verify the errgroup propagates it correctly
    • Semaphore cap: verify no more than 10 concurrent goroutines are dispatched (use a counter or mock delay)
  2. Use httptest.NewServer to mock the Gitea API endpoints
  3. Tests must pass with go test -race ./internal/gitea/...

Acceptance Criteria

  • At least 3 test cases per function: happy path (multi-org), sort order, error propagation
  • go test -race passes with no data races
  • Test file follows existing patterns in the codebase
## Roadmap Reference Phase 1.4 — Gitea Aggregation Layer: - `ListAllIssues(orgs []string)` — Fan-out across repos with `errgroup`, merge + sort by updated time - `ListAllPullRequests(orgs []string)` — Same pattern for PRs, includes review status - Concurrent API calls across repos using `errgroup` with a semaphore (cap at 5-10) ## What to Do 1. In `internal/gitea/client_test.go`, add unit tests for `ListAllIssues` and `ListAllPullRequests` covering: - **Multi-org fan-out**: mock multiple orgs/repos returning different issues, verify all are merged into the result - **Sort order**: results must be sorted by `updated_at` descending - **Error handling**: if one org returns an error, verify the errgroup propagates it correctly - **Semaphore cap**: verify no more than 10 concurrent goroutines are dispatched (use a counter or mock delay) 2. Use `httptest.NewServer` to mock the Gitea API endpoints 3. Tests must pass with `go test -race ./internal/gitea/...` ## Acceptance Criteria - At least 3 test cases per function: happy path (multi-org), sort order, error propagation - `go test -race` passes with no data races - Test file follows existing patterns in the codebase
AI-Manager added the P2agent-readymedium labels 2026-04-20 21:25:31 +00:00
AI-QA was assigned by AI-Manager 2026-05-18 21:29:03 +00:00
Author
Owner

Triage: Assigned to @AI-QA. Delegating to @qa-engineer agent. P2 task -- unit tests for ListAllIssues/ListAllPullRequests fan-out.

**Triage:** Assigned to @AI-QA. Delegating to @qa-engineer agent. P2 task -- unit tests for ListAllIssues/ListAllPullRequests fan-out.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/gitea-mobile#226