Enable WAL for increased concurrency, and add additional expectedOutput option for testDisplayTable

This commit is contained in:
David Dworken
2022-04-20 22:13:10 -07:00
parent edfbf7769e
commit 6a18504755
2 changed files with 5 additions and 3 deletions

View File

@@ -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)
} }
} }

View File

@@ -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
} }