restic: tighten RunCheck lock sniff + RunStats zero-snapshot test
Narrow the LockPresent predicate from bare "locked" (too broad) to "stale lock" and "already locked" — the two phrases restic actually emits. Replace TestRunCheckParsesLock with table-driven TestRunCheckLockSniff covering both trigger phrases and a benign "locked-file" line that must not set LockPresent. Add TestRunStatsZeroSnapshots to pin that RunStats accepts zero-snapshot JSON without error.
This commit is contained in:
@@ -367,7 +367,7 @@ func (e Env) RunCheck(ctx context.Context, subsetPct int, handle LineHandler) (C
|
||||
var res CheckResult
|
||||
sniff := func(stream, line string, ev any) {
|
||||
if stream == "stderr" {
|
||||
if strings.Contains(line, "Found stale lock") || strings.Contains(line, "locked") {
|
||||
if strings.Contains(line, "stale lock") || strings.Contains(line, "already locked") {
|
||||
res.LockPresent = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user