Files
felhom-controller/controller/internal/web/a_version_travel_test.go
T
admin b6810f14ff
gates / gates (push) Successful in 23s
v0.275.0: a backup's data and its version travel together (R-696, 07 §6.6, D4 option A); R-695, R-691, R-694
The unit's data files are stamped with the versions that wrote them; the capture keeps the
definition the data belongs to; a restore never starts data under another version's
definition (unit restores refuse a mismatch; the off-site restore writes the snapshot's
definition); every tier's time is its data's; the conversion-copy release needs a dump on
the new engine. File-browser sync single-flight + no empty kept folder (R-695); the kept
view joins the folder's owning group, language switch resyncs (R-691); a restore-generated
login is not shown as the password (R-694). Red-proofs in
felhom.eu/documentation/audits/version-travel-2026-09-26/.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-09-26 10:35:22 +02:00

49 lines
2.0 KiB
Go

package web
import (
"strings"
"testing"
"time"
)
// TestA3_RestoredVersionSentence — the FIRST sentence after a restore of an older version (v0.275.0,
// `07` §6.6, D4 option A), both languages, and its absence when nothing changed. The brief's wording is
// the contract: which backup, which version, and what happens next.
func TestA3_RestoredVersionSentence(t *testing.T) {
s := noteServer(t)
at := time.Date(2026, 9, 26, 7, 29, 45, 0, time.UTC)
pins := []string{"docmost/docmost:0.96.0@sha256:b5", "postgres:16-alpine", "redis:7-alpine"}
s.versionPosition = func(string) (bool, bool) { return true, true }
got := s.restoredVersionPrefix("docmost", true, pins, at)
for _, want := range []string{"A(z) docmost visszaállt a(z) 2026-09-26 ", "-i mentésből", "docmost:0.96.0, postgres:16-alpine, redis:7-alpine verzióra", "lépésenként hozza naprakészre"} {
if !strings.Contains(got, want) {
t.Errorf("hu: missing %q in %q", want, got)
}
}
if !strings.HasSuffix(got, " ") {
t.Errorf("the prefix must end with a space before the outcome sentence: %q", got)
}
if err := s.settings.SetLanguage("en"); err != nil {
t.Fatal(err)
}
got = s.restoredVersionPrefix("docmost", true, pins, at)
if !strings.Contains(got, "docmost is back from the backup of 2026-09-26 ") || !strings.Contains(got, "one step at a time") {
t.Errorf("en: %q", got)
}
// No tested step leads on from the restored version: say the box will not update it by itself.
s.versionPosition = func(string) (bool, bool) { return true, false }
if got := s.restoredVersionPrefix("docmost", true, pins, at); !strings.Contains(got, "does not update it by itself") {
t.Errorf("no ladder step: %q", got)
}
// Nothing changed, or the app is not behind: no sentence.
if got := s.restoredVersionPrefix("docmost", false, pins, at); got != "" {
t.Errorf("unchanged version: %q", got)
}
s.versionPosition = func(string) (bool, bool) { return false, false }
if got := s.restoredVersionPrefix("docmost", true, pins, at); got != "" {
t.Errorf("not behind: %q", got)
}
}