Add another hook point to check HISHTORY_SIMULATE_NETWORK_ERROR so that it also blocks downloading updates

This commit is contained in:
David Dworken 2023-10-22 11:30:49 -07:00
parent 9433bd6e94
commit fdbe91246e
No known key found for this signature in database

View File

@ -251,6 +251,11 @@ func getTmpClientPath() string {
}
func downloadFile(filename, url string) error {
// Support simulating network errors for the purposes of testing
if os.Getenv("HISHTORY_SIMULATE_NETWORK_ERROR") != "" {
return fmt.Errorf("simulated network error: dial tcp: lookup api.hishtory.dev")
}
// Download the data
resp, err := http.Get(url)
if err != nil {