Skip to content

test(chart): render ingress.yaml and the service/serviceaccount/configmap wiring under helm unittest (charts/prow-github-app/tests) - #626

Merged
mrbobbytables merged 2 commits into
mainfrom
quality/test-chart-ingress-wiring
Oct 31, 2026
Merged

mrbobbytables merged 2 commits into
mainfrom
quality/test-chart-ingress-wiring

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Two helm-unittest suites under charts/prow-github-app/tests/; nothing under templates/, values*, ci/, src/, docs or workflows.

  • tests/ingress_test.yaml — disabled renders no document; the install docs/github-app.md:79-81 documents (className=nginx, one host, /webhook Exact) renders a networking.k8s.io/v1 Ingress whose backend is the chart fullname on port name http; a path without pathType gets Prefix; tls/annotations pass through and each host becomes one rule.
  • tests/wiring_test.yaml — service.yaml names its port http (the contract the ingress backend and the probes rely on) and selects the selector labels; the ServiceAccount is token-less and release-named, serviceAccount.name/annotations pass through to the account and both pod specs, create: false renders no account and the pods use default (or the given name); the ConfigMap carries the prow.* inputs as strings, adds GITHUB_API_URL only when github.apiUrl is set, and is what both containers envFrom; extraEnv entries land after the chart's own env in both containers; an empty image.tag resolves to Chart.AppVersion, image.tag/pullPolicy/imagePullSecrets override in both pod specs; fullnameOverride names every resource and the references between them.

Why. The ingress is the webhook's public entry point, yet schema_test.yaml and topology_test.yaml render only deployment/pdb/secret/cronjob, and both ci/*.yaml kind installs leave ingress.enabled false — so the template was reached by neither suite (run 40969205788, chart job green). The service/serviceaccount/configmap templates were reached end to end with default values only; none of their non-default arms was asserted anywhere.

Files / cluster claimed — charts/prow-github-app/tests/{ingress,wiring}_test.yaml only; disjoint from #621 (__tests__/bundle/, src/issueComment/labelSync.ts).

Testing

At the PR head on main@db0322e, helm 3.19.0 + helm-unittest 1.2.1:

  • helm unittest charts/prow-github-app — 4 suites, 30 tests passed (15 existing + 15 new)
  • every new case fails without its arm; each of these template edits turned exactly the expected test(s) red and nothing else, then was reverted: pathType | default "Prefix" → "ImplementationSpecific"; backend port: {name: http} → number: 8080; dropping the className, tls or annotations with blocks; inverting if .Values.ingress.enabled; service port name: http → web; serviceAccountName fallback "default" → "none"; if .Values.serviceAccount.create → if true; dropping the SA annotations block; dropping or unconditionalising the GITHUB_API_URL arm; dropping | toString | quote on PROW_DRY_RUN; dropping the extraEnv range, or moving it above PROW_REPLICAS; default .Chart.AppVersion .Values.image.tag → .Values.image.tag; if .Values.fullnameOverride → if false; dropping the CronJob imagePullSecrets block
  • no .github/workflows change is needed: the chart job's existing helm unittest charts/prow-github-app step picks the new files up

Related Issue

Closes #625 — both boxes of the finding are in this PR.


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…gmap wiring under helm unittest

The ingress is the documented webhook entry point yet no suite rendered it
and both kind installs leave it disabled; the service port name it targets,
the serviceAccount.create false fallback, github.apiUrl, extraEnv,
image.tag's appVersion default and fullnameOverride were likewise never
asserted. Each case fails when its template arm is removed.

Closes #625

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 29, 2026 23:02
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Agent PRs are held at ACMM L3–L5; an outreach PR that targets a repository this hive does not manage is held at every level because it publishes project-facing communication into someone else's project.

Hive will keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
fc8ae8e

ℹ️ Sentinel notice — informational; author is trusted (hive agent), merge is not blocked

Hive flagged this PR (author @hivecommons-hive[bot], head fc8ae8e4e11f) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 2 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • charts/prow-github-app/tests/ingress_test.yaml
    • charts/prow-github-app/tests/wiring_test.yaml

Hive did not add the sentinel-alert label because this author is trusted. The finding remains recorded for audit and the dashboard Security tab; set sentinel.trusted_authors_block: true to require the blocking label for trusted authors too.

@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.

Conclusion: the tests are sound, but build-test is red because of this PR's own YAML quoting — seven yaml/quotes lint errors need fixing before this can merge.

The failing check is not infrastructure. npm run lint (run 40970358907, build-test job) fails on the two new files:

  • charts/prow-github-app/tests/ingress_test.yaml:24,41,59 — path: "spec.rules[0].host" etc.
  • charts/prow-github-app/tests/wiring_test.yaml:127,129,138,140 — path: "spec.template.spec.containers[0].image" etc.

The repo's eslint yaml/quotes rule requires single quotes. Each of the seven is a bracketed JSONPath that does need quoting inside a flow mapping, so the fix is mechanical: "…" → '…' (e.g. {path: 'spec.rules[0].host', …}). npx eslint --fix charts/prow-github-app/tests/ should do all seven. The jsdoc/check-param-names warning in src/issueComment/cc.ts:78 is pre-existing, not this PR's.

On the substance, I verified the assertions against the templates at this head:

  • ingress.yaml:24 — pathType: {{ .pathType | default "Prefix" }} matches the Prefix-default case; ingress.yaml:29 backs the port: {name: http} backend assertion, and service.yaml:10 names the service port http, so the wiring_test "port named http" case is asserting the real contract between the two templates.
  • serviceaccount.yaml:1 gates on .Values.serviceAccount.create, and _helpers.tpl:30-34 falls back to "default" when create is false — the three SA cases match.
  • configmap.yaml:11-13 pipes PROW_DRY_RUN through toString | quote and emits GITHUB_API_URL only when github.apiUrl is set — the string-typed data assertion is correct.

The PR body's claim that no workflow change is needed is right: the chart job's existing helm unittest charts/prow-github-app step picked the suites up and passed at this head. Once the quoting is fixed this looks correct to me; the coverage gap it closes (ingress rendered by neither test suite nor the ci/*.yaml installs) is real.

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

jeefy
jeefy previously requested changes Oct 30, 2026

@jeefy jeefy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks — ingress and the wiring were the two things my 15 specs skipped, so this is welcome. build-test is red on yaml/quotes (the repo's eslint config lints chart test yaml and wants single quotes; see the errors at lines 24, 41, 127-140). Fix those and I will merge.

@jeefy

jeefy commented Oct 30, 2026

Copy link
Copy Markdown
Member

/kind cleanup

@github-actions github-actions Bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed needs-kind labels Oct 30, 2026
The repo's eslint yaml/quotes rule lints chart test YAML and requires
single quotes; the seven bracketed paths inside flow mappings were
double-quoted and failed build-test on #626.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Thanks @jeefy — fixed in a8cb8b4: the seven bracketed JSONPaths (ingress_test.yaml:24,41,59, wiring_test.yaml:127,129,138,140) are now single-quoted via npx eslint --fix charts/prow-github-app/tests/. Verified locally at this head: npx eslint charts/prow-github-app/tests/ clean; helm unittest charts/prow-github-app (helm 3.19.0, helm-unittest 1.2.1) — 4 suites, 30/30 passed. No other files changed.


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: a8cb8b4

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
a8cb8b4

ℹ️ Sentinel notice — informational; author is trusted (hive agent), merge is not blocked

Hive flagged this PR (author @hivecommons-hive[bot], head a8cb8b4a5d2a) because it matches behaviors that can override security controls, escalate privileges or damage the codebase. This is a heuristic, not an accusation — a maintainer should confirm the change is intended before it merges.

  • sensitive_path — changes 2 sensitive path(s) (Touches a sensitive path (OWNERS, workflows, policies, hive config, security docs, …))
    • charts/prow-github-app/tests/ingress_test.yaml
    • charts/prow-github-app/tests/wiring_test.yaml

Hive did not add the sentinel-alert label because this author is trusted. The finding remains recorded for audit and the dashboard Security tab; set sentinel.trusted_authors_block: true to require the blocking label for trusted authors too.

@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.

Looks correct to me; @jeefy's requested change is addressed at the current head (a8cb8b4).

Both prior reviews were on fc8ae8e, where build-test failed on seven yaml/quotes errors. a8cb8b4 single-quotes the bracketed JSONPaths ('spec.rules[0].host' etc.) and every check on this head is now green, including build-test and chart.

What I verified against the tree at a8cb8b4, not just the diff:

  • tests/ingress_test.yaml assertions match templates/ingress.yaml exactly: {{- if .Values.ingress.enabled }} gates the whole document (line 1), pathType: {{ .pathType | default "Prefix" }} (line 25), backend port: name: http to include "prow-github-app.fullname" $ (lines 27–30), and with-gated className/tls/annotations. The disabled-by-default case matches values.yaml:56 (ingress.enabled: false).
  • tests/wiring_test.yaml matches the templates and helpers: service.yaml ports [{name: http, port: 8080, targetPort: http}] (values.yaml:53 port: 8080); serviceAccountName helper falls back to default when create: false and to the fullname otherwise (_helpers.tpl:30-36); configmap.yaml quotes PROW_DRY_RUN via | toString | quote and gates GITHUB_API_URL on .Values.github.apiUrl; prow-github-app.image is repository:(default .Chart.AppVersion .Values.image.tag) (_helpers.tpl:43-45), matching the appVersion: 3.4.0 case; fullnameOverride short-circuits in _helpers.tpl:6-8, matching the cross-reference assertions.
  • Tests-only: the diff adds the two suites and touches nothing under templates/, values*, src/ or workflows, matching the PR body's scope claim. Both checkboxes of #625 are covered, and Closes #625 is the right link — nothing in the issue is left open.

The hold label is the repo's hold-gated agent-PR policy, so merging remains a maintainer's call — but from a correctness standpoint I found nothing to change.

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

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

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Projects

None yet

2 participants