Invert condition so that a bunch of golden tests only run on actions, since that is now our primary testing environment (#159)

* Invert condition so that a bunch of golden tests only run on actions, since that is now our primary testing environment

* Update goldens to match them on GH actions

* Update goldens to split them based on OS so they can run on GH actions

* Add runtime.GOOS to golden names

* Update goldens that are now split by OS

* Update another test to fork on OS

* Update shell exclusion to properly exclude fish

* More golden updates

* Add more goldens

* More goldens
This commit is contained in:
David Dworken 2023-12-29 07:31:56 -08:00 committed by GitHub
parent 040669a823
commit 29ba7bc272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 68 additions and 35 deletions

View File

@ -1940,8 +1940,8 @@ func testTui_general(t *testing.T, onlineStatus OnlineStatus) {
"Escape",
})
require.NotContains(t, out, "Search Query:")
if !testutils.IsGithubAction() {
testutils.CompareGoldens(t, out, "TestTui-Exit")
if testutils.IsGithubAction() {
testutils.CompareGoldens(t, out, "TestTui-Exit-"+runtime.GOOS)
}
// Test opening the help page
@ -2147,9 +2147,13 @@ func testControlR(t *testing.T, tester shellTester, shellName string, onlineStat
require.NotContains(t, out, "Search Query", "hishtory is showing a table even after control-c?")
require.NotContains(t, out, "─────", "hishtory is showing a table even after control-c?")
require.NotContains(t, out, "Exit Code", "hishtory is showing a table even after control-c?")
if !testutils.IsGithubAction() {
// This bit is broken on actions since actions run as a different user
testutils.CompareGoldens(t, out, "testControlR-ControlC-"+shellName)
if testutils.IsGithubAction() {
if shellName == "fish" {
require.Contains(t, out, "Welcome to fish, the friendly interactive shell")
require.Contains(t, out, "> echo ")
} else {
testutils.CompareGoldens(t, out, "testControlR-ControlC-"+shellName+"-"+runtime.GOOS)
}
}
// Disable control-r
@ -2159,9 +2163,8 @@ func testControlR(t *testing.T, tester shellTester, shellName string, onlineStat
require.NotContains(t, out, "Search Query", "hishtory overrode control-r even when this was disabled?")
require.NotContains(t, out, "─────", "hishtory overrode control-r even when this was disabled?")
require.NotContains(t, out, "Exit Code", "hishtory overrode control-r even when this was disabled?")
if !testutils.IsGithubAction() {
// This bit is broken on actions since actions run as a different user
testutils.CompareGoldens(t, out, "testControlR-"+shellName+"-Disabled")
if testutils.IsGithubAction() && shellName != "fish" {
testutils.CompareGoldens(t, out, "testControlR-"+shellName+"-Disabled-"+runtime.GOOS)
}
// Re-enable control-r
@ -2186,8 +2189,8 @@ func testControlR(t *testing.T, tester shellTester, shellName string, onlineStat
// Check that we can select it correctly
out = stripShellPrefix(captureTerminalOutputWithShellName(t, tester, shellName, []string{"C-R", "Slah", "Enter"}))
require.Contains(t, out, "-Slah", "out has unexpected output missing the selected row")
if !testutils.IsGithubAction() {
testutils.CompareGoldens(t, out, "testControlR-SelectMultiline-"+shellName)
if testutils.IsGithubAction() && shellName != "fish" {
testutils.CompareGoldens(t, out, "testControlR-SelectMultiline-"+shellName+"-"+runtime.GOOS)
}
// Assert there are no leaked connections
@ -2441,13 +2444,13 @@ echo bar`)
testutils.CompareGoldens(t, out, "testUninstall-post-uninstall")
// And check again, but in a way that shows the full terminal output
if !testutils.IsGithubAction() {
if testutils.IsGithubAction() {
out = captureTerminalOutput(t, tester, []string{
"echo SPACE foo ENTER",
"hishtory ENTER",
"echo SPACE bar ENTER",
})
testutils.CompareGoldens(t, out, "testUninstall-post-uninstall-"+tester.ShellName())
testutils.CompareGoldens(t, out, "testUninstall-post-uninstall-"+tester.ShellName()+"-"+runtime.GOOS)
}
}

View File

@ -1,3 +0,0 @@
david@ghaction-runner-hostname hishtory % hishtory tquery
david@ghaction-runner-hostname hishtory %

3
client/testdata/TestTui-Exit-darwin vendored Normal file
View File

@ -0,0 +1,3 @@
runner@ghaction-runner-hostname hishtory % hishtory tquery
runner@ghaction-runner-hostname hishtory %

3
client/testdata/TestTui-Exit-linux vendored Normal file
View File

@ -0,0 +1,3 @@
ghaction-runner-hostname% hishtory tquery
ghaction-runner-hostname%

View File

@ -1,2 +0,0 @@
bash-5.2$ source /Users/david/.bashrc
bash-5.2$ echo

View File

@ -0,0 +1,2 @@
bash-5.2$ source /Users/runner/.bashrc
bash-5.2$ echo

View File

@ -0,0 +1,2 @@
runner@ghaction-runner-hostname:~/work/hishtory/hishtory$ source /home/runner/.bashrc
runner@ghaction-runner-hostname:~/work/hishtory/hishtory$ echo

View File

@ -1,3 +0,0 @@
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
david@Davids-MacBook-Air ~/c/hishtory (master)> echo 'aaaaaa bbbb'

View File

@ -1 +0,0 @@
david@Davids-MacBook-Air hishtory % echo

View File

@ -0,0 +1 @@
runner@ghaction-runner-hostname hishtory % echo

View File

@ -0,0 +1 @@
ghaction-runner-hostname% echo

View File

@ -0,0 +1,2 @@
bash-5.2$ source /Users/runner/.bashrc
bash-5.2$ ls -Slah /

View File

@ -0,0 +1,2 @@
runner@ghaction-runner-hostname:~/work/hishtory/hishtory$ source /home/runner/.bashrc
runner@ghaction-runner-hostname:~/work/hishtory/hishtory$ ls -Slah /

View File

@ -1,3 +0,0 @@
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
david@Davids-MacBook-Air ~/c/hishtory (master)> ls -Slah /AppleInternal/

View File

@ -0,0 +1,3 @@
runner@ghaction-runner-hostname hishtory % ls \
-Slah \
/

View File

@ -0,0 +1,3 @@
ghaction-runner-hostname% ls \
-Slah \
/

View File

@ -0,0 +1,2 @@
bash-5.2$ source /Users/runner/.bashrc
(reverse-i-search)`':

View File

@ -0,0 +1,2 @@
runner@ghaction-runner-hostname:~/work/hishtory/hishtory$ source /home/runner/.bashrc
(reverse-i-search)`':

View File

@ -1,3 +0,0 @@
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
david@Davids-MacBook-Air ~/c/hishtory (master)>

View File

@ -0,0 +1,2 @@
runner@ghaction-runner-hostname hishtory %
bck-i-search: _

View File

@ -0,0 +1,2 @@
ghaction-runner-hostname%
bck-i-search: _

View File

@ -1,4 +1,4 @@
bash-5.2$ source /Users/david/.bashrc
bash-5.2$ source /Users/runner/.bashrc
bash-5.2$ echo foo
foo
bash-5.2$ hishtory

View File

@ -0,0 +1,8 @@
runner@ghaction-runner-hostname:~/work/hishtory/hishtory$ source /home/runner/.bashrc
runner@ghaction-runner-hostname:~/work/hishtory/hishtory$ echo foo
foo
runner@ghaction-runner-hostname:~/work/hishtory/hishtory$ hishtory
hishtory: command not found
runner@ghaction-runner-hostname:~/work/hishtory/hishtory$ echo bar
bar
runner@ghaction-runner-hostname:~/work/hishtory/hishtory$

View File

@ -1,7 +0,0 @@
david@Davids-MacBook-Air hishtory % echo foo
foo
david@Davids-MacBook-Air hishtory % hishtory
zsh: command not found: hishtory
david@Davids-MacBook-Air hishtory % echo bar
bar
david@Davids-MacBook-Air hishtory %

View File

@ -0,0 +1,7 @@
runner@ghaction-runner-hostname hishtory % echo foo
foo
runner@ghaction-runner-hostname hishtory % hishtory
zsh: command not found: hishtory
runner@ghaction-runner-hostname hishtory % echo bar
bar
runner@ghaction-runner-hostname hishtory %

View File

@ -0,0 +1,7 @@
ghaction-runner-hostname% echo foo
foo
ghaction-runner-hostname% hishtory
zsh: command not found: hishtory
ghaction-runner-hostname% echo bar
bar
ghaction-runner-hostname%