Skip to content

test: add unit coverage for pipelines_client.go fetch wrappers - #24019

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-pipelines-client-fetch
Oct 5, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-pipelines-client-fetch

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds unit tests for fetchRuns, fetchWorkflowRuns, and fetchJobs in
pkg/api/handlers/github/pipelines_client.go, which were at 0% coverage
(see linked issue for the CI-artifact evidence). Uses the existing
RoundTripFunc HTTP-mock helper already present in this package
(pipelines_client_test.go) — no new test infrastructure.

Cases covered per function: success/decode, 404-treated-as-empty,
>=400-is-error, malformed-JSON, transport error, and (for fetchRuns)
pagination across multiple full pages up to ghpMaxPages.

Verified with go build against a renamed-to-.go copy of the test file
in a scratch package (go test/go vet are disabled for agents in this
environment); this PR's own CI run is the first real test execution.

Closes #24018


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-opus-4.7 copilot=1.0.88

fetchRuns, fetchWorkflowRuns, and fetchJobs in
pkg/api/handlers/github/pipelines_client.go were at 0% unit coverage
(go-test.yml run 37222865140) despite backing every view on the
/ci-cd pipeline dashboard. Add tests using the existing RoundTripFunc
HTTP-mock pattern already in this package, covering success/decode,
404-is-empty, >=400-is-error, malformed JSON, and fetchRuns'
multi-page aggregation up to ghpMaxPages.

Signed-off-by: quality <quality@hive.kubestellar.io>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 5, 2026
@netlify

netlify Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for kubestellarconsole canceled.

Name Link
🔨 Latest commit 06c9ddc
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6ac3e1a2a4556a0008ad36d7

@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign eeshaansa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

👋 Hey @hivecommons-hive[bot] — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 5, 2026
@github-actions github-actions Bot added ai-generated Pull request generated by AI tier/1-lightweight labels Oct 5, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the tests against the implementations in pkg/api/handlers/github/pipelines_client.go at this head (06c9ddc). The cases match the actual code paths: fetchWorkflowRuns returns nil, nil on 404 (pipelines_client.go:198-200), fetchRuns treats 404 as done via ghpDecodeWorkflowRuns (pipelines_client.go:168-170) and paginates with pageSize capped at ghpMaxPerPage (pipelines_client.go:110-116) — the 250→3×100-page test exercises that correctly. Transport errors bypass the rate-limit retry in ghGetWithRetry (pipelines_client.go:64-66), so the error tests are fast. Helpers reuse the existing RoundTripFunc without symbol collisions, and CI's go test ./... is green on this head. Looks correct to me.

One minor note (not a defect): the comment in TestFetchRuns_SinglePageUnderPageSize says a short page "signals the last page, so fetchRuns must not issue a second request", but with per_page=10, maxPages computes to 1 (pipelines_client.go:113), so the loop could never issue a second request regardless — the len(runs) < pageSize short-circuit at pipelines_client.go:138 is not actually what that test exercises. Worth fixing the comment (or using a query that yields maxPages > 1) if this PR is touched again; fine to merge as is.

— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88

@hivecommons-hive
hivecommons-hive Bot merged commit ccae5ff into main Oct 5, 2026
43 of 44 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-pipelines-client-fetch branch October 5, 2026 18:13
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Post-merge build verification passed ✅

Both Go and frontend builds compiled successfully against merge commit ccae5ff64f3602270a19a0803595079c5808b244.

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

✅ Post-Merge Verification: passed

Commit: ccae5ff64f3602270a19a0803595079c5808b244
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/37354316040

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

Labels

ai-generated Pull request generated by AI dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tier/1-lightweight

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] pipelines_client.go fetchRuns/fetchWorkflowRuns/fetchJobs at 0% coverage — no unit or e2e test

0 participants