healthcheck_test.go — fiber Source File
Architecture documentation for healthcheck_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 06fd3a09_de22_eff7_9240_dbc4380b44fd["healthcheck_test.go"] dbea2ac8_9b7c_9118_714a_b9e222cbb2e2["http"] 06fd3a09_de22_eff7_9240_dbc4380b44fd --> dbea2ac8_9b7c_9118_714a_b9e222cbb2e2 style 06fd3a09_de22_eff7_9240_dbc4380b44fd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package healthcheck
import (
"net/http"
"net/http/httptest"
"strconv"
"testing"
"github.com/gofiber/fiber/v3"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
func shouldGiveStatus(t *testing.T, app *fiber.App, path string, expectedStatus int) {
t.Helper()
req, err := app.Test(httptest.NewRequest(fiber.MethodGet, path, http.NoBody))
require.NoError(t, err)
require.Equal(t, expectedStatus, req.StatusCode, "path: "+path+" should match "+strconv.Itoa(expectedStatus))
}
func shouldGiveOK(t *testing.T, app *fiber.App, path string) {
t.Helper()
shouldGiveStatus(t, app, path, fiber.StatusOK)
}
func shouldGiveNotFound(t *testing.T, app *fiber.App, path string) {
t.Helper()
shouldGiveStatus(t, app, path, fiber.StatusNotFound)
}
func Test_HealthCheck_Strict_Routing_Default(t *testing.T) {
t.Parallel()
app := fiber.New(fiber.Config{
StrictRouting: true,
})
app.Get(LivenessEndpoint, New())
app.Get(ReadinessEndpoint, New())
app.Get(StartupEndpoint, New())
shouldGiveOK(t, app, "/readyz")
shouldGiveOK(t, app, "/livez")
shouldGiveOK(t, app, "/startupz")
shouldGiveNotFound(t, app, "/readyz/")
shouldGiveNotFound(t, app, "/livez/")
shouldGiveNotFound(t, app, "/startupz/")
shouldGiveNotFound(t, app, "/notDefined/readyz")
shouldGiveNotFound(t, app, "/notDefined/livez")
shouldGiveNotFound(t, app, "/notDefined/startupz")
}
func Test_HealthCheck_Default(t *testing.T) {
t.Parallel()
app := fiber.New()
app.Get(LivenessEndpoint, New())
app.Get(ReadinessEndpoint, New())
app.Get(StartupEndpoint, New())
// ... (168 more lines)
Domain
Subdomains
Functions
Dependencies
- http
Source
Frequently Asked Questions
What does healthcheck_test.go do?
healthcheck_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Adapters subdomain.
What functions are defined in healthcheck_test.go?
healthcheck_test.go defines 10 function(s): Benchmark_HealthCheck, Benchmark_HealthCheck_Parallel, Test_HealthCheck_Custom, Test_HealthCheck_Custom_Nested, Test_HealthCheck_Default, Test_HealthCheck_Next, Test_HealthCheck_Strict_Routing_Default, shouldGiveNotFound, shouldGiveOK, shouldGiveStatus.
What does healthcheck_test.go depend on?
healthcheck_test.go imports 1 module(s): http.
Where is healthcheck_test.go in the architecture?
healthcheck_test.go is located at middleware/healthcheck/healthcheck_test.go (domain: FiberCore, subdomain: Adapters, directory: middleware/healthcheck).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free