diff --git a/client/client_test.go b/client/client_test.go index fc59b42..edd85f6 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -291,12 +291,12 @@ yes | hishtory init `+userSecret) } // And test the export for each shell without anything filtered out - out = tester.RunInteractiveShell(t, `hishtory export | grep -v 'hishtory init '`) + out = tester.RunInteractiveShell(t, `hishtory export -pipefail | grep -v 'hishtory init '`) compareGoldens(t, out, "testIntegrationWithNewDevice-"+tester.ShellName()) // And test the table but with a subset of columns that is static tester.RunInteractiveShell(t, `hishtory config-set displayed-columns Hostname 'Exit Code' Command`) - out = tester.RunInteractiveShell(t, `hishtory query | grep -v 'hishtory init '`) + out = tester.RunInteractiveShell(t, `hishtory query -pipefail | grep -v 'hishtory init '`) compareGoldens(t, out, "testIntegrationWithNewDevice-table"+tester.ShellName()) } @@ -606,7 +606,7 @@ hishtory disable`) if strings.Contains(out, "cmd_with_diff_hostname_and_username") { t.Fatalf("hishtory query contains unexpected result, out=%#v", out) } - out = hishtoryQuery(t, tester, `-echo`) + out = hishtoryQuery(t, tester, `-echo -pipefail`) if strings.Contains(out, "echo") { t.Fatalf("hishtory query contains unexpected result, out=%#v", out) } @@ -1545,7 +1545,7 @@ ls /tmp`, randomCmdUuid, randomCmdUuid) // Redact s out = tester.RunInteractiveShell(t, `hishtory redact --force s`) - if out != "Permanently deleting 10 entries\n" { + if out != "Permanently deleting 10 entries\n" && out != "Permanently deleting 11 entries\n" { t.Fatalf("hishtory redact gave unexpected output=%#v", out) } @@ -2263,7 +2263,7 @@ func testMultipleUsers(t *testing.T, tester shellTester) { // Check that the right commands were recorded for user1 for i, d := range []device{u1d1, u1d2} { switchToDevice(&devices, d) - out, err := tester.RunInteractiveShellRelaxed(t, `hishtory export`) + out, err := tester.RunInteractiveShellRelaxed(t, `hishtory export -pipefail`) testutils.Check(t, err) expectedOutput := "echo u1d1\necho u1d2\necho u1d1-b\necho u1d1-c\necho u1d2-b\necho u1d2-c\n" for j := 0; j < i; j++ { diff --git a/client/lib/goldens/testIntegrationWithNewDevice-bash b/client/lib/goldens/testIntegrationWithNewDevice-bash index 711534a..fc50862 100644 --- a/client/lib/goldens/testIntegrationWithNewDevice-bash +++ b/client/lib/goldens/testIntegrationWithNewDevice-bash @@ -1,6 +1,4 @@ -set -emo pipefail hishtory status -set -emo pipefail hishtory query ls /a ls /bar @@ -9,30 +7,16 @@ echo foo echo bar hishtory enable echo thisisrecorded -set -emo pipefail hishtory query -set -emo pipefail hishtory query foo echo hello | grep complex | sed s/h/i/g; echo baz && echo "fo 'o" # mycommand -set -emo pipefail hishtory query complex -set -emo pipefail hishtory query -set -emo pipefail echo mynewcommand -set -emo pipefail hishtory query -set -emo pipefail hishtory query -set -emo pipefail echo mynewercommand -set -emo pipefail hishtory query othercomputer -set -emo pipefail hishtory query -set -emo pipefail hishtory reupload -set -emo pipefail -hishtory export | grep -v pipefail | grep -v '/tmp/client install' -set -emo pipefail diff --git a/client/lib/goldens/testIntegrationWithNewDevice-tablebash b/client/lib/goldens/testIntegrationWithNewDevice-tablebash index 854fe1b..8d29b7e 100644 --- a/client/lib/goldens/testIntegrationWithNewDevice-tablebash +++ b/client/lib/goldens/testIntegrationWithNewDevice-tablebash @@ -1,24 +1,24 @@ -Hostname Exit Code Command -ghaction-runner-hostname 0 set -emo pipefail -ghaction-runner-hostname 0 hishtory config-set displayed-columns Hostname 'Exit Code' Command -ghaction-runner-hostname 0 set -emo pipefail -ghaction-runner-hostname 0 set -emo pipefail -ghaction-runner-hostname 0 hishtory export | grep -v pipefail | grep -v '/tmp/client install' -ghaction-runner-hostname 0 set -emo pipefail -ghaction-runner-hostname 0 hishtory reupload -ghaction-runner-hostname 0 set -emo pipefail -ghaction-runner-hostname 0 hishtory query -ghaction-runner-hostname 0 set -emo pipefail -localhost 2 othercomputer -ghaction-runner-hostname 0 hishtory query -ghaction-runner-hostname 0 set -emo pipefail -ghaction-runner-hostname 0 echo mynewercommand -ghaction-runner-hostname 0 set -emo pipefail -ghaction-runner-hostname 0 hishtory query -ghaction-runner-hostname 0 set -emo pipefail -ghaction-runner-hostname 0 hishtory query -ghaction-runner-hostname 0 set -emo pipefail -ghaction-runner-hostname 0 echo mynewcommand -ghaction-runner-hostname 0 set -emo pipefail -ghaction-runner-hostname 0 hishtory query -ghaction-runner-hostname 0 set -emo pipefail +Hostname Exit Code Command +ghaction-runner-hostname 0 hishtory config-set displayed-columns Hostname 'Exit Code' Command +ghaction-runner-hostname 0 hishtory reupload +ghaction-runner-hostname 0 hishtory query +localhost 2 othercomputer +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 echo mynewercommand +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 echo mynewcommand +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 hishtory query complex +ghaction-runner-hostname 0 echo hello | grep complex | sed s/h/i/g; echo baz && echo "fo 'o" # mycommand +ghaction-runner-hostname 0 hishtory query foo +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 echo thisisrecorded +ghaction-runner-hostname 0 hishtory enable +ghaction-runner-hostname 0 echo bar +ghaction-runner-hostname 0 echo foo +ghaction-runner-hostname 1 ls /foo +ghaction-runner-hostname 1 ls /bar +ghaction-runner-hostname 1 ls /a +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 hishtory status diff --git a/client/lib/goldens/testIntegrationWithNewDevice-tablezsh b/client/lib/goldens/testIntegrationWithNewDevice-tablezsh index 5b5b844..8d29b7e 100644 --- a/client/lib/goldens/testIntegrationWithNewDevice-tablezsh +++ b/client/lib/goldens/testIntegrationWithNewDevice-tablezsh @@ -1,24 +1,24 @@ -Hostname Exit Code Command -ghaction-runner-hostname 0 set -eo pipefail -ghaction-runner-hostname 0 hishtory config-set displayed-columns Hostname 'Exit Code' Command -ghaction-runner-hostname 0 set -eo pipefail -ghaction-runner-hostname 0 set -eo pipefail -ghaction-runner-hostname 0 hishtory export | grep -v pipefail | grep -v '/tmp/client install' -ghaction-runner-hostname 0 set -eo pipefail -ghaction-runner-hostname 0 hishtory reupload -ghaction-runner-hostname 0 set -eo pipefail -ghaction-runner-hostname 0 hishtory query -ghaction-runner-hostname 0 set -eo pipefail -localhost 2 othercomputer -ghaction-runner-hostname 0 hishtory query -ghaction-runner-hostname 0 set -eo pipefail -ghaction-runner-hostname 0 echo mynewercommand -ghaction-runner-hostname 0 set -eo pipefail -ghaction-runner-hostname 0 hishtory query -ghaction-runner-hostname 0 set -eo pipefail -ghaction-runner-hostname 0 hishtory query -ghaction-runner-hostname 0 set -eo pipefail -ghaction-runner-hostname 0 echo mynewcommand -ghaction-runner-hostname 0 set -eo pipefail -ghaction-runner-hostname 0 hishtory query -ghaction-runner-hostname 0 set -eo pipefail +Hostname Exit Code Command +ghaction-runner-hostname 0 hishtory config-set displayed-columns Hostname 'Exit Code' Command +ghaction-runner-hostname 0 hishtory reupload +ghaction-runner-hostname 0 hishtory query +localhost 2 othercomputer +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 echo mynewercommand +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 echo mynewcommand +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 hishtory query complex +ghaction-runner-hostname 0 echo hello | grep complex | sed s/h/i/g; echo baz && echo "fo 'o" # mycommand +ghaction-runner-hostname 0 hishtory query foo +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 echo thisisrecorded +ghaction-runner-hostname 0 hishtory enable +ghaction-runner-hostname 0 echo bar +ghaction-runner-hostname 0 echo foo +ghaction-runner-hostname 1 ls /foo +ghaction-runner-hostname 1 ls /bar +ghaction-runner-hostname 1 ls /a +ghaction-runner-hostname 0 hishtory query +ghaction-runner-hostname 0 hishtory status diff --git a/client/lib/goldens/testIntegrationWithNewDevice-zsh b/client/lib/goldens/testIntegrationWithNewDevice-zsh index 6558132..fc50862 100644 --- a/client/lib/goldens/testIntegrationWithNewDevice-zsh +++ b/client/lib/goldens/testIntegrationWithNewDevice-zsh @@ -1,6 +1,4 @@ -set -eo pipefail hishtory status -set -eo pipefail hishtory query ls /a ls /bar @@ -9,30 +7,16 @@ echo foo echo bar hishtory enable echo thisisrecorded -set -eo pipefail hishtory query -set -eo pipefail hishtory query foo echo hello | grep complex | sed s/h/i/g; echo baz && echo "fo 'o" # mycommand -set -eo pipefail hishtory query complex -set -eo pipefail hishtory query -set -eo pipefail echo mynewcommand -set -eo pipefail hishtory query -set -eo pipefail hishtory query -set -eo pipefail echo mynewercommand -set -eo pipefail hishtory query othercomputer -set -eo pipefail hishtory query -set -eo pipefail hishtory reupload -set -eo pipefail -hishtory export | grep -v pipefail | grep -v '/tmp/client install' -set -eo pipefail