1
0
Fork 0

Enhance DB checkpoint unit test

master
Philip O'Toole 8 months ago
parent ac1af31a08
commit 36ff916a6e

@ -465,10 +465,16 @@ func Test_WALDatabaseCreatedOK(t *testing.T) {
if _, err := os.Stat(walPath); os.IsNotExist(err) {
t.Fatalf("WAL file does not exist")
}
if mustFileSize(walPath) == 0 {
t.Fatalf("WAL file exists but is empty")
}
if err := db.Checkpoint(); err != nil {
t.Fatalf("failed to checkpoint database in WAL mode: %s", err.Error())
}
if mustFileSize(walPath) != 0 {
t.Fatalf("WAL file exists but is non-empty")
}
// Checkpoint a second time, to ensure it's idempotent.
if err := db.Checkpoint(); err != nil {
t.Fatalf("failed to checkpoint database in WAL mode: %s", err.Error())

Loading…
Cancel
Save