Update TestSortByConsistentTimezone to not use a golden for tquery since it was leading to occasional flakes, and swap it to using a regex. Also add a test for hishtory export as part of the sorting tests.

This commit is contained in:
David Dworken 2023-09-12 19:09:01 -07:00
parent 4c40a8a177
commit f1e2b8ddbf
No known key found for this signature in database
4 changed files with 6 additions and 63 deletions

View File

@ -2410,9 +2410,11 @@ func TestSortByConsistentTimezone(t *testing.T) {
// And check that they're displayed in the correct order
out := hishtoryQuery(t, tester, "-pipefail -tablesizing")
testutils.CompareGoldens(t, out, "TestSortByConsistentTimezone-query")
out = tester.RunInteractiveShell(t, `hishtory export -pipefail -tablesizing`)
testutils.CompareGoldens(t, out, "TestSortByConsistentTimezone-export")
out = captureTerminalOutput(t, tester, []string{"hishtory SPACE tquery SPACE -pipefail SPACE -tablesizing ENTER"})
out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1])
testutils.CompareGoldens(t, out, fmt.Sprintf("TestSortByConsistentTimezone-tquery-isAction=%v", testutils.IsGithubAction()))
require.Regexp(t, regexp.MustCompile(`Timestamp[\s\S]*Command[\s\S]*Apr 16 2022 01:36:26 PDT[\s\S]*third_entry[\s\S]*Apr 16 2022 01:19:46 PDT[\s\S]*second_entry[\s\S]*Apr 16 2022 01:03:06 PDT[\s\S]*first_entry`), out)
}
func TestZDotDir(t *testing.T) {

View File

@ -0,0 +1,3 @@
first_entry
second_entry
third_entry

View File

@ -1,31 +0,0 @@
-pipefail -tablesizing
Search Query: > -pipefail -tablesizing
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hostname CWD Timestamp Runtime Exit Code Command │
│────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ localhost /tmp/ Apr 16 2022 01:36:26 PDT 1s 2 third_entry │
│ localhost /tmp/ Apr 16 2022 01:19:46 PDT 1s 2 second_entry │
│ localhost /tmp/ Apr 16 2022 01:03:06 PDT 1s 2 first_entry │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
hiSHtory: Search your shell history • ctrl+h help

View File

@ -1,31 +0,0 @@
-pipefail -tablesizing
Search Query: > -pipefail -tablesizing
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Hostname CWD Timestamp Runtime Exit Code Command │
│────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│
│ localhost /tmp/ Apr 16 2022 01:36:26 PDT 1s 2 third_entry │
│ localhost /tmp/ Apr 16 2022 01:19:46 PDT 1s 2 second_entry │
│ localhost /tmp/ Apr 16 2022 01:03:06 PDT 1s 2 first_entry │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
hiSHtory: Search your shell history • ctrl+h help