All checks were successful
Build and Publish Docker Image / deploy (push) Successful in 1m38s
- Add a multi-stage Dockerfile for building and running the Go backend - Add .dockerignore to optimize the Docker build context - Create a Gitea Actions workflow to build and publish Docker images on tag push - Register a new `/health` endpoint for container healthchecks - Update README.md with Docker and Podman deployment instructions - Ignore local `docker-compose.yml` in .gitignore
29 lines
592 B
Go
29 lines
592 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestHealthRoutes(t *testing.T) {
|
|
app, cleanup := newTestApp(t)
|
|
defer cleanup()
|
|
|
|
mux := http.NewServeMux()
|
|
app.RegisterRoutes(mux)
|
|
|
|
for _, path := range []string{"/health", "/healthz", "/api/v1/health"} {
|
|
t.Run(path, func(t *testing.T) {
|
|
request := httptest.NewRequest(http.MethodGet, path, nil)
|
|
response := httptest.NewRecorder()
|
|
|
|
mux.ServeHTTP(response, request)
|
|
|
|
if response.Code != http.StatusOK {
|
|
t.Fatalf("status = %d, body = %s", response.Code, response.Body.String())
|
|
}
|
|
})
|
|
}
|
|
}
|