Test that scan refuses another schema version (closes #64)
check / check (push) Waiting to run
check / check (push) Waiting to run
The version-mismatch test only opened its database through openReportDatabase, so nothing exercised the branch of initSchema that stops scan on a database stamped with an unknown schema version. The test now opens the same database through openScanDatabase too and requires errSchemaVersion, and is renamed to match the unversioned-file test beside it, which also covers both paths. Model: opus-5-5
This commit was merged in pull request #82.
This commit is contained in:
+9
-2
@@ -157,9 +157,11 @@ func TestOpenReportDatabaseMissing(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpenReportDatabaseVersionMismatch(t *testing.T) {
|
||||
func TestOpenDatabaseVersionMismatch(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// A database stamped with a schema version other than 0 and
|
||||
// schemaVersion. report, trees and scan must all refuse it.
|
||||
path := testDBPath(t)
|
||||
|
||||
db, err := openScanDatabase(t.Context(), path)
|
||||
@@ -176,7 +178,12 @@ func TestOpenReportDatabaseVersionMismatch(t *testing.T) {
|
||||
|
||||
_, err = openReportDatabase(t.Context(), path)
|
||||
if !errors.Is(err, errSchemaVersion) {
|
||||
t.Fatalf("err = %v, want errSchemaVersion", err)
|
||||
t.Fatalf("report: err = %v, want errSchemaVersion", err)
|
||||
}
|
||||
|
||||
_, err = openScanDatabase(t.Context(), path)
|
||||
if !errors.Is(err, errSchemaVersion) {
|
||||
t.Fatalf("scan: err = %v, want errSchemaVersion", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user