Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Keep immutable seed checks compatible with same-run E2E images

pulse-triage[bot]08b30faf1442
diff --git a/scripts/installtests/integration_container_test.go b/scripts/installtests/integration_container_test.go
index f51a8285c9..9ed0deb5f0 100644
--- a/scripts/installtests/integration_container_test.go
+++ b/scripts/installtests/integration_container_test.go
@@ -21,7 +21,7 @@ func TestIntegrationContainersUseGovernedImmutableBases(t *testing.T) {
t.Fatalf("read integration compose file: %v", err)
}
compose := string(composeBytes)
- if !regexpDigestPinnedImage(`alpine:3.24`, compose) {
+ if !integrationSeedUsesGovernedDefault(`alpine:3.24`, compose) {
t.Fatal("integration seed image must use the governed Alpine line pinned by a full immutable digest")
}
if strings.Contains(dockerfile, "golang:1.23-alpine") || strings.Contains(compose, "image: alpine:3.20\n") {
@@ -29,7 +29,41 @@ func TestIntegrationContainersUseGovernedImmutableBases(t *testing.T) {
}
}
-func regexpDigestPinnedImage(image string, content string) bool {
- pattern := regexp.MustCompile(`(?m)^\s*image:\s*` + regexp.QuoteMeta(image) + `@sha256:[0-9a-f]{64}\s*$`)
+func integrationSeedUsesGovernedDefault(image string, content string) bool {
+ // The same-run image bundle supplies the CI override. The local fallback
+ // must still be the governed immutable image, not an arbitrary variable or
+ // an unpinned default. Bundle admission is checked by its connected suite.
+ pinned := regexp.QuoteMeta(image) + `@sha256:[0-9a-f]{64}`
+ pattern := regexp.MustCompile(`(?m)^[\t ]*image:[\t ]*(?:` + pinned + `|\$\{PULSE_E2E_SEED_IMAGE:-` + pinned + `\})[\t ]*$`)
return pattern.MatchString(content)
}
+
+func TestIntegrationSeedGovernedDefaultAdmission(t *testing.T) {
+ pinned := "alpine:3.24@sha256:" + strings.Repeat("a", 64)
+ for _, content := range []string{
+ " image: " + pinned + "\n",
+ " image: ${PULSE_E2E_SEED_IMAGE:-" + pinned + "}\n",
+ } {
+ if !integrationSeedUsesGovernedDefault("alpine:3.24", content) {
+ t.Fatalf("refused governed seed default: %q", content)
+ }
+ }
+ for name, content := range map[string]string{
+ "mutable": "image: alpine:3.24",
+ "mutable default": "image: ${PULSE_E2E_SEED_IMAGE:-alpine:3.24}",
+ "retired line": "image: ${PULSE_E2E_SEED_IMAGE:-alpine:3.20@sha256:" + strings.Repeat("a", 64) + "}",
+ "short digest": "image: ${PULSE_E2E_SEED_IMAGE:-" + strings.TrimSuffix(pinned, "a") + "}",
+ "foreign variable": "image: ${OTHER_IMAGE:-" + pinned + "}",
+ "missing default": "image: ${PULSE_E2E_SEED_IMAGE}",
+ "missing brace": "image: ${PULSE_E2E_SEED_IMAGE:-" + pinned,
+ "extra suffix": "image: ${PULSE_E2E_SEED_IMAGE:-" + pinned + "}suffix",
+ "extra brace": "image: " + pinned + "}",
+ "wrong service key": "other_image: " + pinned,
+ } {
+ t.Run(name, func(t *testing.T) {
+ if integrationSeedUsesGovernedDefault("alpine:3.24", content) {
+ t.Fatalf("accepted invalid seed default: %q", content)
+ }
+ })
+ }
+}