Add more tests to testIntegrationWithNewDevice

This commit is contained in:
David Dworken 2022-11-01 10:45:16 -07:00
parent acef5c0879
commit add3693967
No known key found for this signature in database
3 changed files with 71 additions and 0 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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