Skip to content

test: pin DibsDown/DibsPodRestarting matchers and the scrape chain to deploy/ manifests - #354

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-alertrules-manifest-contract
Oct 10, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-alertrules-manifest-contract

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds pkg/server/alertrules_manifest_test.go, a companion to alertrules_test.go.

The existing contract tests pin every dibs_* selector in deploy/monitoring/prometheusrule.yaml to what /metrics emits, but skip selectors on series Dibs does not export — DibsDown (up{namespace,job}) and DibsPodRestarting (kube_pod_container_status_restarts_total{namespace,container}, #352). Those matchers name objects in deploy/ and were tied to nothing; a renamed container or Service would silence both alerts with CI green.

New tests:

  • TestAlertRulesNonAppSelectorsMatchDeployManifests — for every non-dibs_ selector, namespace= must equal deploy/namespace.yaml, container= must be a container in deployment.yaml, job= must equal the ServiceMonitor scrape job (Service name, or jobLabel); any other equality matcher fails so it gets pinned deliberately. kube_* series must be in an explicit allowlist.
  • TestServiceMonitorScrapesDeclaredMetricsPort — ServiceMonitor matchLabels ⊆ Service labels, Service selector ⊆ pod template labels, endpoint port → Service port → container port resolve by name, path is /metrics, all four objects share the namespace.

No production code changes. gofmt -l clean; go mod tidy is a no-op (uses gopkg.in/yaml.v3, already a direct dependency).

Closes #353


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

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

… deploy/ manifests

The alert-rule contract tests skip selectors on series Dibs does not
emit (up, kube_*), so the namespace/container/job matchers on DibsDown
and DibsPodRestarting were tied to nothing. Check them against
deploy/namespace.yaml, deployment.yaml, service.yaml and
servicemonitor.yaml, allowlist the kube-state-metrics series, and walk
the ServiceMonitor -> Service -> container port chain by name.

Closes #353

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 10, 2026
@kubestellar-prow

Copy link
Copy Markdown

[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 clubanderson 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

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 10, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 3462741 into main Oct 10, 2026
6 of 7 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-alertrules-manifest-contract branch October 10, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] Pin DibsDown/DibsPodRestarting label matchers and the ServiceMonitor scrape chain to deploy/ manifests

0 participants