diff --git a/client/client_test.go b/client/client_test.go index 452efb2..7a09af0 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -273,6 +273,15 @@ func testIntegrationWithNewDevice(t *testing.T, tester shellTester) { if diff := cmp.Diff(expectedOutput, out); diff != "" { t.Fatalf("hishtory export mismatch (-expected +got):\n%s\nout=%#v", diff, out) } + + // And test the export for each shell without anything filtered out + out = tester.RunInteractiveShell(t, `hishtory export | 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 '`) + compareGoldens(t, out, "testIntegrationWithNewDevice-table"+tester.ShellName()) } func installHishtory(t *testing.T, tester shellTester, userSecret string) string { diff --git a/client/lib/goldens/testIntegrationWithNewDevice-bash b/client/lib/goldens/testIntegrationWithNewDevice-bash new file mode 100644 index 0000000..9c5dc63 --- /dev/null +++ b/client/lib/goldens/testIntegrationWithNewDevice-bash @@ -0,0 +1,38 @@ +set -emo pipefail +hishtory status +set -emo pipefail +hishtory query +ls /a +ls /bar +ls /foo +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" +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 new file mode 100644 index 0000000..854fe1b --- /dev/null +++ b/client/lib/goldens/testIntegrationWithNewDevice-tablebash @@ -0,0 +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