Normalize hostnames to attempt to get tests to pass in github actions

This commit is contained in:
David Dworken 2022-10-27 23:30:09 -07:00
parent 38ca02b961
commit 189f183d69
9 changed files with 19 additions and 10 deletions

View File

@ -29,5 +29,5 @@ jobs:
brew install fish tmux bash || true
export TZ='America/Los_Angeles' # Force the time zone so that test output is consistent
sudo chmod 0755 -R /usr/share/zsh/ || true # Work around a weird bug where zsh on ubuntu actiosn gives that diretory 0777 which makes zsh refuse to start
sudo hostname github-action-runner # Set a consistent hostname so we can run tests that depend on it
sudo hostname ghaction-runner-hostname # Set a consistent hostname so we can run tests that depend on it
make test

View File

@ -1724,7 +1724,16 @@ func TestFish(t *testing.T) {
}
}
func normalizeHostnames(data string) string {
hostnames := []string{"Davids-MacBook-Air.local", "ghaction-runner-hostname"}
for _, hostname := range hostnames {
data = strings.ReplaceAll(data, hostname, "ghaction-runner-hostname")
}
return data
}
func compareGoldens(t *testing.T, out, goldenName string) {
out = normalizeHostnames(out)
goldenPath := path.Join("client/lib/goldens/", goldenName)
expected, err := os.ReadFile(goldenPath)
if err != nil {

View File

@ -3,7 +3,7 @@ Search Query: > -pipefail
┌─────────────────────────────────────────────────────────────────────────────┐
│ Hostname Exit Code Command foo │
│─────────────────────────────────────────────────────────────────────────────│
Davids-MacBook-Air.local 0 ls / foo │
ghaction-runner-hostname 0 ls / foo │
│ localhost 2 echo 'bar' & │
│ localhost 2 echo 'aaaaaa bbbb' │
│ localhost 2 ls ~/bar/ │

View File

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

View File

@ -1,4 +1,4 @@
Hostname Command
Davids-MacBook-Air.local hishtory query table
ghaction-runner-hostname hishtory query table
localhost table_cmd2
localhost table_cmd1

View File

@ -1,4 +1,4 @@
Hostname Exit Code Command
Davids-MacBook-Air.local 0 hishtory query table
ghaction-runner-hostname 0 hishtory query table
localhost 3 table_cmd2
localhost 2 table_cmd1

View File

@ -1,4 +1,4 @@
Hostname Exit Code Command CWD
Davids-MacBook-Air.local 0 hishtory query table ~/code/hishtory
ghaction-runner-hostname 0 hishtory query table ~/code/hishtory
localhost 3 table_cmd2 ~/foo/
localhost 2 table_cmd1 /tmp/

View File

@ -1,5 +1,5 @@
Hostname Exit Code Command CWD
Davids-MacBook-Air.local 0 hishtory query table ~/code/hishtory
ghaction-runner-hostname 0 hishtory query table ~/code/hishtory
localhost 2 while : /tmp/
do
ls /table/

View File

@ -1,7 +1,7 @@
Hostname Exit Code Command CWD foo
Davids-MacBook-Air.local 0 echo table-2 ~/code/hishtory aaaaaaaaaaaaa
Davids-MacBook-Air.local 0 echo table-1 ~/code/hishtory aaaaaaaaaaaaa
Davids-MacBook-Air.local 0 hishtory query table ~/code/hishtory
ghaction-runner-hostname 0 echo table-2 ~/code/hishtory aaaaaaaaaaaaa
ghaction-runner-hostname 0 echo table-1 ~/code/hishtory aaaaaaaaaaaaa
ghaction-runner-hostname 0 hishtory query table ~/code/hishtory
localhost 2 while : /tmp/
do
ls /table/