From 6e7822ebaef94e50fbcb2ef1e9fa8eb3bea74b23 Mon Sep 17 00:00:00 2001 From: David Dworken Date: Sat, 12 Nov 2022 06:18:05 -0800 Subject: [PATCH] Attempt to fix github action only test failures --- .github/workflows/go-test.yml | 10 ++-- client/client_test.go | 7 ++- client/lib/goldens/TestTimestampFormat-tquery | 52 +++++++++---------- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index fae01d7..73a2c9c 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -33,8 +33,8 @@ jobs: sudo hostname ghaction-runner-hostname || true # Set a consistent hostname so we can run tests that depend on it sudo scutil --set HostName ghaction-runner-hostname || true make test - # - name: Setup tmate session - # if: ${{ failure() }} - # uses: mxschmitt/action-tmate@v3 - # with: - # limit-access-to-actor: true \ No newline at end of file + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true \ No newline at end of file diff --git a/client/client_test.go b/client/client_test.go index 2cc2909..92760a2 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -2111,6 +2111,9 @@ func TestTimestampFormat(t *testing.T) { defer testutils.BackupAndRestore(t)() userSecret := installHishtory(t, tester, "") + // Add an entry just to ensure we get consistent table sizing + tester.RunInteractiveShell(t, "echo tablesizing") + // Add some entries with fixed timestamps tmz, err := time.LoadLocation("America/Los_Angeles") if err != nil { @@ -2131,9 +2134,9 @@ func TestTimestampFormat(t *testing.T) { tester.RunInteractiveShell(t, ` hishtory config-set timestamp-format '2006/Jan/2 15:04'`) // And check that it is displayed in both the tui and the classic view - out := hishtoryQuery(t, tester, "-pipefail") + out := hishtoryQuery(t, tester, "-pipefail -tablesizing") compareGoldens(t, out, "TestTimestampFormat-query") - out = captureTerminalOutput(t, tester, []string{"hishtory SPACE tquery SPACE -pipefail ENTER"}) + out = captureTerminalOutput(t, tester, []string{"hishtory SPACE tquery SPACE -pipefail SPACE -tablesizing ENTER"}) out = strings.TrimSpace(strings.Split(out, "hishtory tquery")[1]) compareGoldens(t, out, "TestTimestampFormat-tquery") } diff --git a/client/lib/goldens/TestTimestampFormat-tquery b/client/lib/goldens/TestTimestampFormat-tquery index 181d3f9..9f7bbc3 100644 --- a/client/lib/goldens/TestTimestampFormat-tquery +++ b/client/lib/goldens/TestTimestampFormat-tquery @@ -1,30 +1,30 @@ --pipefail +-pipefail -tablesizing -Search Query: > -pipefail +Search Query: > -pipefail -tablesizing -┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ Hostname CWD Timestamp Runtime Exit Code Command │ -│───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│ -│ localhost ~/foo/ 2022/Apr/16 01:03 24s 3 table_cmd2 │ -│ localhost /tmp/ 2022/Apr/16 01:03 4s 2 table_cmd1 │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -│ │ -└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ \ No newline at end of file +┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ +│ Hostname CWD Timestamp Runtime Exit Code Command │ +│────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│ +│ localhost ~/foo/ 2022/Apr/16 01:03 24s 3 table_cmd2 │ +│ localhost /tmp/ 2022/Apr/16 01:03 4s 2 table_cmd1 │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ \ No newline at end of file