Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
36 changes: 36 additions & 0 deletions src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading