Skip to content

Commit d2477ea

Browse files
committed
Merge main (#147) into the JSON-family sidecar backend branch (#146)
#147 (test-only postgres validate + gc fixture) landed on main after this branch was pushed. Incorporated by keeping #147's postgres-storage validate test and reconciling the gc rejection test with #148's dispatch (postgres gc now reports "not yet implemented"; the json family is supported). https://claude.ai/code/session_01S2xDQQU5o85N3xTpeFUSfN
2 parents 48583b1 + 871db26 commit d2477ea

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

src/gc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ mod tests {
343343

344344
#[test]
345345
fn gc_rejects_postgres_backend() {
346+
// `postgres` is a valid generate-time dialect, but gc is not yet
347+
// implemented for it and must refuse rather than silently no-op.
348+
// (The json family *is* now supported — see the json gc test below.)
346349
let m = fixture("/dev/null", RetentionConfig::default(), "postgres");
347350
let err = run_gc(&m, true).unwrap_err();
348351
assert!(

src/manifest/mod.rs

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

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

0 commit comments

Comments
 (0)