Files
felhom-controller/controller/internal/stacks/r674_head_test.go
T
2026-09-24 16:49:43 +02:00

31 lines
1.2 KiB
Go

package stacks
import (
"path/filepath"
"strings"
"testing"
)
// R-674 (v0.270.0): a pin equal to the ladder's newest `to` is AT THE HEAD — the log must not call it
// "older than the ladder".
//
// COMPANION RED-PROOF (REPORT.md): drop the head branch in nextLadderStep → "the head was called older
// than the ladder".
func TestR674_HeadIsNotCalledOlder(t *testing.T) {
dir := t.TempDir()
mustWrite(t, filepath.Join(dir, ".felhom.yml"), "display_name: X\nupdate_ladder:\n"+ladderLine(ladderA, ladderB)+ladderLine(ladderB, ladderC))
mustWrite(t, filepath.Join(dir, "docker-compose.yml"), "services:\n web:\n image: "+ladderC+"\n")
step, err := nextLadderStep(dir, map[string]string{"web": ladderC})
if err != nil {
t.Fatal(err)
}
if strings.Contains(step.Why, "older than the ladder") || !strings.Contains(step.Why, "AT THE HEAD") {
t.Fatalf("the head was called older than the ladder: %q", step.Why)
}
// Control: a pin the ladder does not know is still said so.
step, _ = nextLadderStep(dir, map[string]string{"web": "nextcloud:30.0.0-apache"})
if !strings.Contains(step.Why, "matches no update_ladder entry") {
t.Fatalf("the unknown-pin sentence changed: %q", step.Why)
}
}