Skip to content

Commit 871db26

Browse files
test(manifest,gc): positive postgres-storage case + realistic gc fixture (#147)
Test-only follow-up to #144 (which dropped the json sidecar store and closed #112). Adds a positive postgres-storage validate test and switches the gc rejection test to the realistic non-sqlite value. No production change; the storage set stays closed to sqlite + postgres. https://claude.ai/code/session_01Ux144vBDdySvLUqUrCgkT4
1 parent e94d2a2 commit 871db26

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

src/gc.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,10 @@ mod tests {
309309

310310
#[test]
311311
fn gc_rejects_non_sqlite_backend() {
312-
let m = fixture("/dev/null", RetentionConfig::default(), "json");
312+
// `postgres` is a valid generate-time dialect, but gc is SQLite-only
313+
// and must refuse rather than silently no-op. (The `json` value was
314+
// dropped as a storage option entirely in V-L2-F2 / #112.)
315+
let m = fixture("/dev/null", RetentionConfig::default(), "postgres");
313316
let err = run_gc(&m, true).unwrap_err();
314317
assert!(
315318
err.to_string().contains("only supports the SQLite sidecar"),

src/manifest/mod.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,42 @@ mod validate_manifest_tests {
429429
);
430430
}
431431

432+
/// Complements `unsupported_storage_fails`: the PostgreSQL dialect is a
433+
/// supported `[sidecar].storage` value (it selects the postgres DDL for
434+
/// `generate`), so a postgres sidecar must *pass* the
435+
/// `sidecar-storage-supported` check and validate cleanly.
436+
#[test]
437+
fn postgres_storage_passes_storage_check() {
438+
let dir = tempfile::tempdir().expect("tempdir");
439+
let path = dir.path().join("verisimiser.toml");
440+
let sidecar_path = dir.path().join("sidecar.db");
441+
let body = format!(
442+
"[project]\n\
443+
name = \"test\"\n\
444+
[database]\n\
445+
backend = \"postgresql\"\n\
446+
[sidecar]\n\
447+
storage = \"postgres\"\n\
448+
path = \"{}\"\n",
449+
sidecar_path.display().to_string().replace('\\', "/")
450+
);
451+
std::fs::write(&path, body).expect("write");
452+
453+
let report = validate_manifest(path.to_str().unwrap());
454+
assert!(
455+
report.passed,
456+
"postgres storage must validate; checks: {:?}",
457+
report.checks
458+
);
459+
assert!(
460+
report
461+
.checks
462+
.iter()
463+
.any(|c| c.name == "sidecar-storage-supported" && c.passed),
464+
"the storage-supported check must run and pass for postgres"
465+
);
466+
}
467+
432468
/// A malformed manifest must fail `manifest-loads` and stop further
433469
/// checks (because the rest depend on having a parsed manifest).
434470
#[test]

0 commit comments

Comments
 (0)