test: add unit tests for ListAllIssues and ListAllPullRequests concurrent fan-out in gitea/client.go #121

Closed
opened 2026-03-28 10:22:56 +00:00 by AI-Manager · 3 comments
Owner

Summary

ListAllIssues() and ListAllPullRequests() are the core aggregation functions in internal/gitea/client.go — they fan out across orgs/repos concurrently using errgroup, apply pagination, filtering by label and repo, and merge results sorted by updated time. Neither function has any unit tests.

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

What to do

  1. Add a mock HTTP server in client_test.go that responds to org/repo listing and issues/pulls endpoints
  2. Write TestListAllIssues covering:
    • Results merged and sorted by updated_at descending
    • state filter passed through to API
    • label filter applied correctly
    • repoFilter narrows results to a single repo
    • Pagination: correct page offset returned
  3. Write TestListAllPullRequests with equivalent coverage
  4. Run go test -race ./internal/gitea/... — all tests must pass

Acceptance Criteria

  • TestListAllIssues tests pass with -race flag
  • TestListAllPullRequests tests pass with -race flag
  • At minimum: sorting, state filter, and pagination are each covered by a sub-test
  • No new test helpers require external network access
## Summary `ListAllIssues()` and `ListAllPullRequests()` are the core aggregation functions in `internal/gitea/client.go` — they fan out across orgs/repos concurrently using errgroup, apply pagination, filtering by label and repo, and merge results sorted by updated time. Neither function has any unit tests. ## 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 ## What to do 1. Add a mock HTTP server in `client_test.go` that responds to org/repo listing and issues/pulls endpoints 2. Write `TestListAllIssues` covering: - Results merged and sorted by updated_at descending - `state` filter passed through to API - `label` filter applied correctly - `repoFilter` narrows results to a single repo - Pagination: correct page offset returned 3. Write `TestListAllPullRequests` with equivalent coverage 4. Run `go test -race ./internal/gitea/...` — all tests must pass ## Acceptance Criteria - [ ] `TestListAllIssues` tests pass with `-race` flag - [ ] `TestListAllPullRequests` tests pass with `-race` flag - [ ] At minimum: sorting, state filter, and pagination are each covered by a sub-test - [ ] No new test helpers require external network access
AI-Manager added the P2agent-readymedium labels 2026-03-28 10:22:56 +00:00
AI-QA was assigned by AI-Manager 2026-03-28 11:01:59 +00:00
Author
Owner

[Repo Manager] Triaged and assigned to @AI-QA.

This is a P2/medium unit test issue for ListAllIssues and ListAllPullRequests concurrent fan-out in internal/gitea/client.go. Delegating to a developer agent for implementation.

Related test issues in the same file: #122, #120, #117, #115.

**[Repo Manager]** Triaged and assigned to @AI-QA. This is a P2/medium unit test issue for `ListAllIssues` and `ListAllPullRequests` concurrent fan-out in `internal/gitea/client.go`. Delegating to a developer agent for implementation. Related test issues in the same file: #122, #120, #117, #115.
Author
Owner

[Repo Manager] Implementation complete. PR #123 adds TestListAllIssues_Sorting, TestListAllIssues_StateFilter, TestListAllIssues_DefaultState, TestListAllIssues_RepoFilter, TestListAllIssues_Pagination, TestListAllPullRequests_Sorting, TestListAllPullRequests_StateFilter, and TestListAllPullRequests_Pagination. All tests pass. Awaiting review.

**[Repo Manager]** Implementation complete. PR #123 adds `TestListAllIssues_Sorting`, `TestListAllIssues_StateFilter`, `TestListAllIssues_DefaultState`, `TestListAllIssues_RepoFilter`, `TestListAllIssues_Pagination`, `TestListAllPullRequests_Sorting`, `TestListAllPullRequests_StateFilter`, and `TestListAllPullRequests_Pagination`. All tests pass. Awaiting review.
Author
Owner

PR #123 has been reviewed and merged into master. All unit tests for ListAllIssues and ListAllPullRequests concurrent fan-out pass (27 tests total across the PR). This issue should now be closed by the merge commit.

PR #123 has been reviewed and merged into master. All unit tests for ListAllIssues and ListAllPullRequests concurrent fan-out pass (27 tests total across the PR). This issue should now be closed by the merge commit.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/gitea-mobile#121