cfgPath:=fs.String("config","/etc/felis/felis.toml","path to felis.toml (the host copy, which reaches PostgreSQL on 127.0.0.1)")
statePath:=fs.String("state","/var/lib/felis/watchdog/state.json","state kept between runs (root only: it caches the relay password)")
fallbackState:=fs.String("fallback-state",watchdog.FallbackStatePath,"where a run keeps its state while -state cannot be written, so what it mailed is not mailed again (tmpfs: until the host restarts; \"\" keeps none)")
smtpPasswordFile:=fs.String("smtp-password-file",hostSMTPPasswordPath,"the relay password `felis setup` keeps on the host; the felis-smtp Secret stands in while it is missing")
quietPath:=fs.String("quiet-file","/run/felis/watchdog-quiet-until","Unix time before which nothing is mailed; the installer writes it while it restarts things on purpose")
backupDir:=fs.String("backup-dir","/var/lib/felis/db-backups",`control-plane database backups to check for freshness ("" skips the check)`)
kept:="; kept in "+h.fallbackPath+" until the host restarts"
fori:=range2{
code,stdout,stderr:=h.run()
pings,bodies:=h.pings.got()
ifcode!=1||len(h.rec.sent)!=1||!strings.Contains(stderr,"felis watchdog: save state: ")||
len(pings)!=1||pings[0]!="POST /check-key/fail"||!strings.HasPrefix(bodies[0],"the watchdog state did not save: "){
t.Errorf("exit %d, mailed %v, pings %v %q; want exit 1, one mail and the save failure posted to /fail\nstdout %s\nstderr %s",code,h.rec.sent,pings,bodies,stdout,stderr)
ifcode!=1||len(h.rec.sent)!=1||!strings.Contains(stderr,"felis watchdog: save state: ")||!strings.Contains(stderr,kept)||
len(pings)!=i+1||pings[i]!="POST /check-key/fail"||!strings.HasPrefix(bodies[i],"the watchdog state did not save: "){
t.Fatalf("pass %d: exit %d, mailed %v, pings %v %q; want exit 1, one mail in all and the save failure posted to /fail\nstdout %s\nstderr %s",i,code,h.rec.sent,pings,bodies,stdout,stderr)
t.Fatalf("once the state saves: exit %d, mailed %v, fallback %v; want exit 0, no new mail, the fallback gone\nstdout %s\nstderr %s",code,h.rec.sent,err,stdout,stderr)