mirror of
https://github.com/ddworken/hishtory.git
synced 2025-08-19 11:20:18 +02:00
Enable WAL for increased concurrency, and add additional expectedOutput option for testDisplayTable
This commit is contained in:
@@ -881,8 +881,9 @@ func testDisplayTable(t *testing.T, tester shellTester) {
|
|||||||
|
|
||||||
// Query and check the table
|
// Query and check the table
|
||||||
out := hishtoryQuery(t, tester, "table")
|
out := hishtoryQuery(t, tester, "table")
|
||||||
expectedOutput := "Hostname CWD Timestamp Runtime Exit Code Command \nlocalhost ~/foo/ Apr 16 2022 01:03:16 -0700 24s 3 table_cmd2 \nlocalhost /tmp/ Apr 16 2022 01:03:06 -0700 4s 2 table_cmd1 \n"
|
expectedOutput1 := "Hostname CWD Timestamp Runtime Exit Code Command \nlocalhost ~/foo/ Apr 16 2022 01:03:16 -0700 24s 3 table_cmd2 \nlocalhost /tmp/ Apr 16 2022 01:03:06 -0700 4s 2 table_cmd1 \n"
|
||||||
if diff := cmp.Diff(expectedOutput, out); diff != "" {
|
expectedOutput2 := "Hostname CWD Timestamp Runtime Exit Code Command \nlocalhost ~/foo/ Apr 16 2022 01:03:16 PDT 24s 3 table_cmd2 \nlocalhost /tmp/ Apr 16 2022 01:03:06 PDT 4s 2 table_cmd1 \n"
|
||||||
t.Fatalf("hishtory query table test mismatch (-expected +got):\n%s\nout=%#v", diff, out)
|
if out != expectedOutput1 && out != expectedOutput2 {
|
||||||
|
t.Fatalf("hishtory query table test mismatch out=%#v", out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -658,6 +658,7 @@ func OpenLocalSqliteDb() (*gorm.DB, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
db.AutoMigrate(&data.HistoryEntry{})
|
db.AutoMigrate(&data.HistoryEntry{})
|
||||||
|
db.Exec("PRAGMA journal_mode = WAL")
|
||||||
return db, nil
|
return db, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user