mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-29 03:35:09 +01:00
Add additional check against hishtory export to help debug control-r test failures that only reproduce in github actions
This commit is contained in:
parent
fb07d53839
commit
ad7ca2dffc
@ -1970,15 +1970,17 @@ func testControlR(t *testing.T, tester shellTester, shellName string, onlineStat
|
|||||||
require.NoError(t, db.Create(testutils.MakeFakeHistoryEntry("echo 'aaaaaa bbbb'")).Error)
|
require.NoError(t, db.Create(testutils.MakeFakeHistoryEntry("echo 'aaaaaa bbbb'")).Error)
|
||||||
require.NoError(t, db.Create(testutils.MakeFakeHistoryEntry("echo 'bar' &")).Error)
|
require.NoError(t, db.Create(testutils.MakeFakeHistoryEntry("echo 'bar' &")).Error)
|
||||||
|
|
||||||
// Check that they're there
|
// Check that they're there (and there aren't any other entries)
|
||||||
var historyEntries []*data.HistoryEntry
|
var historyEntries []*data.HistoryEntry
|
||||||
db.Model(&data.HistoryEntry{}).Find(&historyEntries)
|
db.Model(&data.HistoryEntry{}).Find(&historyEntries)
|
||||||
if len(historyEntries) != 5 {
|
if len(historyEntries) != 5 {
|
||||||
t.Fatalf("expected to find 6 history entries, actual found %d: %#v", len(historyEntries), historyEntries)
|
t.Fatalf("expected to find 6 history entries, actual found %d: %#v", len(historyEntries), historyEntries)
|
||||||
}
|
}
|
||||||
|
out := tester.RunInteractiveShell(t, `hishtory export`)
|
||||||
|
testutils.CompareGoldens(t, out, "testControlR-InitialExport")
|
||||||
|
|
||||||
// And check that the control-r binding brings up the search
|
// And check that the control-r binding brings up the search
|
||||||
out := captureTerminalOutputWithShellName(t, tester, shellName, []string{"C-R"})
|
out = captureTerminalOutputWithShellName(t, tester, shellName, []string{"C-R"})
|
||||||
split := strings.Split(out, "\n\n\n")
|
split := strings.Split(out, "\n\n\n")
|
||||||
out = strings.TrimSpace(split[len(split)-1])
|
out = strings.TrimSpace(split[len(split)-1])
|
||||||
testutils.CompareGoldens(t, out, "testControlR-Initial")
|
testutils.CompareGoldens(t, out, "testControlR-Initial")
|
||||||
|
5
client/lib/goldens/testControlR-InitialExport
Normal file
5
client/lib/goldens/testControlR-InitialExport
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
ls ~/
|
||||||
|
ls ~/foo/
|
||||||
|
ls ~/bar/
|
||||||
|
echo 'aaaaaa bbbb'
|
||||||
|
echo 'bar' &
|
@ -260,6 +260,7 @@ func captureTerminalOutputComplex(t testing.TB, captureConfig TmuxCaptureConfig)
|
|||||||
fullCommand += "\n"
|
fullCommand += "\n"
|
||||||
fullCommand += " tmux kill-session -t foo\n"
|
fullCommand += " tmux kill-session -t foo\n"
|
||||||
testutils.TestLog(t, "Running tmux command: "+fullCommand)
|
testutils.TestLog(t, "Running tmux command: "+fullCommand)
|
||||||
|
// TODO: Can this use the strict version instead?
|
||||||
out, err := captureConfig.tester.RunInteractiveShellRelaxed(t, fullCommand)
|
out, err := captureConfig.tester.RunInteractiveShellRelaxed(t, fullCommand)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
return strings.TrimSpace(out)
|
return strings.TrimSpace(out)
|
||||||
|
Loading…
Reference in New Issue
Block a user