Files
backend/tests/00_healthz_test.go
Yi-Ting Shih ad4fba1093
All checks were successful
Go test / run-go-test (push) Successful in 31s
Go test / run-go-vet (push) Successful in 5s
Go test / cleanup-go-test (push) Successful in 4s
Feat: add healthz
2025-12-09 00:55:08 +08:00

28 lines
421 B
Go

package tests
import (
"net/http"
"testing"
"time"
"github.com/go-resty/resty/v2"
)
var client *resty.Client
func Test_00_Healthz(t *testing.T) {
for i := 0; i < 10; i++ {
resp, err := client.R().
Get("http://localhost:8080/healthz")
if err == nil && resp.StatusCode() == http.StatusOK {
return
}
time.Sleep(time.Second)
}
t.Fatal("server did not ready")
}
func init() {
client = resty.New()
}