jesusprubio / up

📶 Troubleshoot problems with your Internet connection
MIT License
446 stars 20 forks source link

fix TestHttpProbe/returns_the_status_code_if_the_request_is_successful #55

Closed abdoroot closed 4 months ago

abdoroot commented 4 months ago

Fixes #52.

jesusprubio commented 4 months ago

Thank you! I would prefer to merge a proper solution instead this workaround.

The problem here is the function newTestHTTPServer returning before the server is listening. Because the call to ListenAndServe is made inside a goroutine: https://github.com/jesusprubio/up/blob/520cd9e9fc0c35e2b1be6f70106bf6ed222bb54a/pkg/protocols_test.go#L66-L67

Please check this solution. I think it should work: https://stackoverflow.com/a/53332769

abdoroot commented 4 months ago

thanks for suggestion it work