diff --git a/src/gc.rs b/src/gc.rs index 16fb4de..d623acf 100644 --- a/src/gc.rs +++ b/src/gc.rs @@ -309,7 +309,10 @@ mod tests { #[test] fn gc_rejects_non_sqlite_backend() { - let m = fixture("/dev/null", RetentionConfig::default(), "json"); + // `postgres` is a valid generate-time dialect, but gc is SQLite-only + // and must refuse rather than silently no-op. (The `json` value was + // dropped as a storage option entirely in V-L2-F2 / #112.) + let m = fixture("/dev/null", RetentionConfig::default(), "postgres"); let err = run_gc(&m, true).unwrap_err(); assert!( err.to_string().contains("only supports the SQLite sidecar"), diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 4bf4379..3fe0bb2 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -429,6 +429,42 @@ mod validate_manifest_tests { ); } + /// Complements `unsupported_storage_fails`: the PostgreSQL dialect is a + /// supported `[sidecar].storage` value (it selects the postgres DDL for + /// `generate`), so a postgres sidecar must *pass* the + /// `sidecar-storage-supported` check and validate cleanly. + #[test] + fn postgres_storage_passes_storage_check() { + let dir = tempfile::tempdir().expect("tempdir"); + let path = dir.path().join("verisimiser.toml"); + let sidecar_path = dir.path().join("sidecar.db"); + let body = format!( + "[project]\n\ + name = \"test\"\n\ + [database]\n\ + backend = \"postgresql\"\n\ + [sidecar]\n\ + storage = \"postgres\"\n\ + path = \"{}\"\n", + sidecar_path.display().to_string().replace('\\', "/") + ); + std::fs::write(&path, body).expect("write"); + + let report = validate_manifest(path.to_str().unwrap()); + assert!( + report.passed, + "postgres storage must validate; checks: {:?}", + report.checks + ); + assert!( + report + .checks + .iter() + .any(|c| c.name == "sidecar-storage-supported" && c.passed), + "the storage-supported check must run and pass for postgres" + ); + } + /// A malformed manifest must fail `manifest-loads` and stop further /// checks (because the rest depend on having a parsed manifest). #[test]