Avoid constantly copying the binary back and forth to make tests faster on github actions

This commit is contained in:
David Dworken 2023-09-02 19:51:43 -07:00
parent 6950215427
commit 2ca6c751d0
No known key found for this signature in database

View File

@ -78,7 +78,6 @@ func BackupAndRestoreWithId(t testing.TB, id string) func() {
path.Join(homedir, data.GetHishtoryPath(), DB_WAL_PATH), path.Join(homedir, data.GetHishtoryPath(), DB_WAL_PATH),
path.Join(homedir, data.GetHishtoryPath(), DB_SHM_PATH), path.Join(homedir, data.GetHishtoryPath(), DB_SHM_PATH),
path.Join(homedir, data.GetHishtoryPath(), data.CONFIG_PATH), path.Join(homedir, data.GetHishtoryPath(), data.CONFIG_PATH),
path.Join(homedir, data.GetHishtoryPath(), "hishtory"),
path.Join(homedir, data.GetHishtoryPath(), "config.sh"), path.Join(homedir, data.GetHishtoryPath(), "config.sh"),
path.Join(homedir, data.GetHishtoryPath(), "config.zsh"), path.Join(homedir, data.GetHishtoryPath(), "config.zsh"),
path.Join(homedir, data.GetHishtoryPath(), "config.fish"), path.Join(homedir, data.GetHishtoryPath(), "config.fish"),
@ -86,6 +85,13 @@ func BackupAndRestoreWithId(t testing.TB, id string) func() {
path.Join(homedir, ".zsh_history"), path.Join(homedir, ".zsh_history"),
path.Join(homedir, ".local/share/fish/fish_history"), path.Join(homedir, ".local/share/fish/fish_history"),
} }
hishtoryBinaryPath := path.Join(homedir, data.GetHishtoryPath(), "hishtory")
if IsGithubAction() {
// On github actions, avoid constantly copying the binary back and forth since we aren't worried about an existing hishtory installation
_ = os.Remove(hishtoryBinaryPath)
} else {
renameFiles = append(renameFiles, hishtoryBinaryPath)
}
for _, file := range renameFiles { for _, file := range renameFiles {
touchFile(file) touchFile(file)
Check(t, rename(file, getBackPath(file, id))) Check(t, rename(file, getBackPath(file, id)))