From fc8ae8e4e11f2fa83489395e2281716054d3e7be Mon Sep 17 00:00:00 2001 From: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:02:20 -0400 Subject: [PATCH 1/2] test(chart): render ingress.yaml and the service/serviceaccount/configmap 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> --- .../prow-github-app/tests/ingress_test.yaml | 59 ++++++ charts/prow-github-app/tests/wiring_test.yaml | 171 ++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644 charts/prow-github-app/tests/ingress_test.yaml create mode 100644 charts/prow-github-app/tests/wiring_test.yaml diff --git a/charts/prow-github-app/tests/ingress_test.yaml b/charts/prow-github-app/tests/ingress_test.yaml new file mode 100644 index 00000000..3944bd04 --- /dev/null +++ b/charts/prow-github-app/tests/ingress_test.yaml @@ -0,0 +1,59 @@ +suite: ingress +templates: [ingress.yaml] +values: [./values/creds.yaml] +tests: + - it: renders nothing by default + asserts: + - hasDocuments: {count: 0} + - it: the documented webhook install routes /webhook exactly to the service's http port + set: + ingress.enabled: true + ingress.className: nginx + ingress.hosts: + - host: prow.example.com + paths: [{path: /webhook, pathType: Exact}] + asserts: + - hasDocuments: {count: 1} + - isKind: {of: Ingress} + - isAPIVersion: {of: networking.k8s.io/v1} + - equal: {path: metadata.name, value: RELEASE-NAME-prow-github-app} + - equal: {path: spec.ingressClassName, value: nginx} + - notExists: {path: spec.tls} + - notExists: {path: metadata.annotations} + - lengthEqual: {path: spec.rules, count: 1} + - equal: {path: "spec.rules[0].host", value: prow.example.com} + - equal: + path: spec.rules[0].http.paths + value: + - path: /webhook + pathType: Exact + backend: + service: + name: RELEASE-NAME-prow-github-app + port: {name: http} + - it: a path without pathType defaults to Prefix + set: + ingress.enabled: true + ingress.hosts: + - host: prow.example.com + paths: [{path: /}] + asserts: + - equal: {path: "spec.rules[0].http.paths[0].pathType", value: Prefix} + - notExists: {path: spec.ingressClassName} + - it: tls and annotations pass through, one rule per host + set: + ingress.enabled: true + ingress.annotations: {cert-manager.io/cluster-issuer: letsencrypt} + ingress.tls: [{secretName: prow-tls, hosts: [prow.example.com]}] + ingress.hosts: + - host: prow.example.com + paths: [{path: /webhook, pathType: Exact}] + - host: prow-alt.example.com + paths: [{path: /webhook, pathType: Exact}] + asserts: + - equal: + path: metadata.annotations + value: {cert-manager.io/cluster-issuer: letsencrypt} + - equal: {path: spec.tls, value: [{secretName: prow-tls, hosts: [prow.example.com]}]} + - lengthEqual: {path: spec.rules, count: 2} + - equal: {path: "spec.rules[1].host", value: prow-alt.example.com} diff --git a/charts/prow-github-app/tests/wiring_test.yaml b/charts/prow-github-app/tests/wiring_test.yaml new file mode 100644 index 00000000..47b74dde --- /dev/null +++ b/charts/prow-github-app/tests/wiring_test.yaml @@ -0,0 +1,171 @@ +suite: wiring +templates: + - service.yaml + - serviceaccount.yaml + - configmap.yaml + - deployment.yaml + - cronjob.yaml +values: + - ./values/creds.yaml +tests: + - it: the service names its port http, the name the ingress and the probes target + template: service.yaml + asserts: + - equal: {path: spec.type, value: ClusterIP} + - equal: + path: spec.ports + value: [{name: http, port: 8080, targetPort: http}] + - equal: + path: spec.selector + value: + app.kubernetes.io/name: prow-github-app + app.kubernetes.io/instance: RELEASE-NAME + - it: creates a token-less service account named after the release by default + template: serviceaccount.yaml + asserts: + - hasDocuments: {count: 1} + - equal: {path: metadata.name, value: RELEASE-NAME-prow-github-app} + - equal: {path: automountServiceAccountToken, value: false} + - notExists: {path: metadata.annotations} + - it: serviceAccount.name and annotations pass through to the account and the pods + set: + serviceAccount.name: ops + serviceAccount.annotations: {eks.amazonaws.com/role-arn: arn:aws:iam::1:role/prow} + asserts: + - equal: {path: metadata.name, value: ops} + template: serviceaccount.yaml + - equal: + path: metadata.annotations + value: {eks.amazonaws.com/role-arn: arn:aws:iam::1:role/prow} + template: serviceaccount.yaml + - equal: {path: spec.template.spec.serviceAccountName, value: ops} + template: deployment.yaml + - equal: {path: spec.jobTemplate.spec.template.spec.serviceAccountName, value: ops} + template: cronjob.yaml + - it: serviceAccount.create false renders no account and the pods use default + set: + serviceAccount.create: false + asserts: + - hasDocuments: {count: 0} + template: serviceaccount.yaml + - equal: {path: spec.template.spec.serviceAccountName, value: default} + template: deployment.yaml + - equal: {path: spec.jobTemplate.spec.template.spec.serviceAccountName, value: default} + template: cronjob.yaml + - it: serviceAccount.create false with a name uses that pre-existing account + set: + serviceAccount.create: false + serviceAccount.name: ops + asserts: + - hasDocuments: {count: 0} + template: serviceaccount.yaml + - equal: {path: spec.template.spec.serviceAccountName, value: ops} + template: deployment.yaml + - it: the configmap carries the prow inputs as strings and no api url for github.com + template: configmap.yaml + asserts: + - equal: + path: data + value: + PROW_COMMANDS: '' + PROW_JOBS: lgtm + PROW_MERGE_METHOD: '' + PROW_CONFIG: '' + PROW_DRY_RUN: 'false' + - it: github.apiUrl and prow values reach the configmap the pods read + set: + github.apiUrl: https://ghes.example/api/v3 + prow.dryRun: true + prow.commands: lgtm approve + prow.mergeMethod: squash + asserts: + - equal: {path: data.GITHUB_API_URL, value: https://ghes.example/api/v3} + template: configmap.yaml + - equal: {path: data.PROW_DRY_RUN, value: 'true'} + template: configmap.yaml + - equal: {path: data.PROW_COMMANDS, value: lgtm approve} + template: configmap.yaml + - equal: {path: data.PROW_MERGE_METHOD, value: squash} + template: configmap.yaml + - equal: + path: spec.template.spec.containers[0].envFrom + value: [{configMapRef: {name: RELEASE-NAME-prow-github-app}}] + template: deployment.yaml + - equal: + path: spec.jobTemplate.spec.template.spec.containers[0].envFrom + value: [{configMapRef: {name: RELEASE-NAME-prow-github-app}}] + template: cronjob.yaml + - it: extraEnv entries land in both containers after the chart's own env + set: + extraEnv: + - {name: NODE_OPTIONS, value: --max-old-space-size=192} + - name: HTTPS_PROXY + valueFrom: {secretKeyRef: {name: proxy, key: url}} + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: {name: NODE_OPTIONS, value: --max-old-space-size=192} + template: deployment.yaml + - contains: + path: spec.template.spec.containers[0].env + content: + name: HTTPS_PROXY + valueFrom: {secretKeyRef: {name: proxy, key: url}} + template: deployment.yaml + - equal: + path: spec.template.spec.containers[0].env[-1].name + value: HTTPS_PROXY + template: deployment.yaml + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: {name: NODE_OPTIONS, value: --max-old-space-size=192} + template: cronjob.yaml + - it: an empty image.tag resolves to the chart appVersion + chart: + appVersion: 3.4.0 + asserts: + - equal: {path: "spec.template.spec.containers[0].image", value: ghcr.io/cncf/prow-github-actions:3.4.0} + template: deployment.yaml + - equal: {path: "spec.jobTemplate.spec.template.spec.containers[0].image", value: ghcr.io/cncf/prow-github-actions:3.4.0} + template: cronjob.yaml + - it: image.tag and imagePullSecrets override the defaults in both pod specs + set: + image.tag: ci + image.repository: prow-github-app + image.pullPolicy: Never + imagePullSecrets: [{name: ghcr}] + asserts: + - equal: {path: "spec.template.spec.containers[0].image", value: prow-github-app:ci} + template: deployment.yaml + - equal: {path: "spec.template.spec.containers[0].imagePullPolicy", value: Never} + template: deployment.yaml + - equal: {path: spec.template.spec.imagePullSecrets, value: [{name: ghcr}]} + template: deployment.yaml + - equal: {path: spec.jobTemplate.spec.template.spec.imagePullSecrets, value: [{name: ghcr}]} + template: cronjob.yaml + - it: fullnameOverride names every resource and the references between them + set: + fullnameOverride: prow + asserts: + - equal: {path: metadata.name, value: prow} + template: service.yaml + - equal: {path: metadata.name, value: prow} + template: serviceaccount.yaml + - equal: {path: metadata.name, value: prow} + template: configmap.yaml + - equal: {path: metadata.name, value: prow} + template: deployment.yaml + - equal: {path: metadata.name, value: prow-jobs} + template: cronjob.yaml + - equal: {path: spec.template.spec.serviceAccountName, value: prow} + template: deployment.yaml + - equal: + path: spec.template.spec.containers[0].envFrom + value: [{configMapRef: {name: prow}}] + template: deployment.yaml + - contains: + path: spec.template.spec.containers[0].env + content: + name: GITHUB_APP_ID + valueFrom: {secretKeyRef: {name: prow, key: appId}} + template: deployment.yaml From a8cb8b4a5d2aba69118ee6d3581b8780817b727f Mon Sep 17 00:00:00 2001 From: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 23:06:59 -0400 Subject: [PATCH 2/2] test(chart): single-quote bracketed JSONPaths to satisfy yaml/quotes 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> --- charts/prow-github-app/tests/ingress_test.yaml | 6 +++--- charts/prow-github-app/tests/wiring_test.yaml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/charts/prow-github-app/tests/ingress_test.yaml b/charts/prow-github-app/tests/ingress_test.yaml index 3944bd04..2d8daa36 100644 --- a/charts/prow-github-app/tests/ingress_test.yaml +++ b/charts/prow-github-app/tests/ingress_test.yaml @@ -21,7 +21,7 @@ tests: - notExists: {path: spec.tls} - notExists: {path: metadata.annotations} - lengthEqual: {path: spec.rules, count: 1} - - equal: {path: "spec.rules[0].host", value: prow.example.com} + - equal: {path: 'spec.rules[0].host', value: prow.example.com} - equal: path: spec.rules[0].http.paths value: @@ -38,7 +38,7 @@ tests: - host: prow.example.com paths: [{path: /}] asserts: - - equal: {path: "spec.rules[0].http.paths[0].pathType", value: Prefix} + - equal: {path: 'spec.rules[0].http.paths[0].pathType', value: Prefix} - notExists: {path: spec.ingressClassName} - it: tls and annotations pass through, one rule per host set: @@ -56,4 +56,4 @@ tests: value: {cert-manager.io/cluster-issuer: letsencrypt} - equal: {path: spec.tls, value: [{secretName: prow-tls, hosts: [prow.example.com]}]} - lengthEqual: {path: spec.rules, count: 2} - - equal: {path: "spec.rules[1].host", value: prow-alt.example.com} + - equal: {path: 'spec.rules[1].host', value: prow-alt.example.com} diff --git a/charts/prow-github-app/tests/wiring_test.yaml b/charts/prow-github-app/tests/wiring_test.yaml index 47b74dde..b9ce2407 100644 --- a/charts/prow-github-app/tests/wiring_test.yaml +++ b/charts/prow-github-app/tests/wiring_test.yaml @@ -124,9 +124,9 @@ tests: chart: appVersion: 3.4.0 asserts: - - equal: {path: "spec.template.spec.containers[0].image", value: ghcr.io/cncf/prow-github-actions:3.4.0} + - equal: {path: 'spec.template.spec.containers[0].image', value: ghcr.io/cncf/prow-github-actions:3.4.0} template: deployment.yaml - - equal: {path: "spec.jobTemplate.spec.template.spec.containers[0].image", value: ghcr.io/cncf/prow-github-actions:3.4.0} + - equal: {path: 'spec.jobTemplate.spec.template.spec.containers[0].image', value: ghcr.io/cncf/prow-github-actions:3.4.0} template: cronjob.yaml - it: image.tag and imagePullSecrets override the defaults in both pod specs set: @@ -135,9 +135,9 @@ tests: image.pullPolicy: Never imagePullSecrets: [{name: ghcr}] asserts: - - equal: {path: "spec.template.spec.containers[0].image", value: prow-github-app:ci} + - equal: {path: 'spec.template.spec.containers[0].image', value: prow-github-app:ci} template: deployment.yaml - - equal: {path: "spec.template.spec.containers[0].imagePullPolicy", value: Never} + - equal: {path: 'spec.template.spec.containers[0].imagePullPolicy', value: Never} template: deployment.yaml - equal: {path: spec.template.spec.imagePullSecrets, value: [{name: ghcr}]} template: deployment.yaml