[quality] make provenance non-Kubernetes regression test hermetic on in-cluster hosts - #5036
Conversation
…in-cluster hosts TestProvenanceReportsSeedWritableOutsideKubernetes assumed the test host has neither KUBERNETES_SERVICE_HOST nor a serviceaccount token, so it failed deterministically on any hive that itself runs in a pod (both signals present). Add config.SetSATokenFileForTest — mirroring the existing SetSecretFileRootsForTest seam — and have the test clear both probes explicitly, matching what config_save_test.go already does in-package. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: hive-quality <sec-check@hive.kubestellar.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Changelog: this PR changes code but does not touch If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
Test Improvement
TestProvenanceReportsSeedWritableOutsideKubernetes(src/pkg/dashboard/api_provenance_test.go) is the #4971 regression test for the non-Kubernetes branch of the config-provenance report. It relied on the test host having neitherKUBERNETES_SERVICE_HOSTnor a serviceaccount token — so on any hive that itself runs in a pod (in-cluster CI runners, dev hives)IsKubernetesPod()reads true and the test fails deterministically with "reported writable=false outside Kubernetes". Verified failing on a clean checkout on an in-cluster host, passing after this change.Changes (files/functions claimed):
src/pkg/config/config.go: add exportedSetSATokenFileForTestseam next tosaTokenFile(mirrors the existingSetSecretFileRootsForTestpattern) so out-of-package tests can force the non-pod branch. Test seam only — no production behavior change (IsKubernetesPodlogic untouched).src/pkg/dashboard/api_provenance_test.go(TestProvenanceReportsSeedWritableOutsideKubernetes): clearKUBERNETES_SERVICE_HOSTand stub the SA-token path explicitly, matching whatconfig_save_test.goalready does in-package.Disjoint from open hold-gated PR #4032 (proxy auth injection:
pkg/proxy,pkg/github,pkg/config/proxy_inject*) — no shared files or functions.Note: while validating,
TestIntegration_SelectTask_PromotionRequiresPRalso failed under full-suite load but passes 3/3 in isolation — flaky, tracked separately, not touched here.Related Issue
None (found during coverage sweep).
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5