mirror of
https://github.com/foomo/keel.git
synced 2025-10-16 12:35:34 +00:00
35 lines
537 B
Go
35 lines
537 B
Go
package service_test
|
|
|
|
import (
|
|
"io"
|
|
"net"
|
|
"net/http"
|
|
"syscall"
|
|
"time"
|
|
)
|
|
|
|
func shutdown() {
|
|
if err := syscall.Kill(syscall.Getpid(), syscall.SIGINT); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func waitFor(addr string) {
|
|
if _, err := net.DialTimeout("tcp", addr, 10*time.Second); err != nil {
|
|
panic(err.Error())
|
|
}
|
|
}
|
|
|
|
func httpGet(url string) string {
|
|
resp, err := http.Get(url)
|
|
if err != nil {
|
|
panic(err.Error())
|
|
}
|
|
defer resp.Body.Close()
|
|
b, err := io.ReadAll(resp.Body)
|
|
if err != nil {
|
|
panic(err.Error())
|
|
}
|
|
return string(b)
|
|
}
|