MCPcopy
hub / github.com/gofiber/fiber / Test_Proxy_Balancer_IPv6_Upstream

Function Test_Proxy_Balancer_IPv6_Upstream

middleware/proxy/proxy_test.go:238–261  ·  view source on GitHub ↗

go test -run Test_Proxy_Balancer_IPv6_Upstream

(t *testing.T)

Source from the content-addressed store, hash-verified

236
237// go test -run Test_Proxy_Balancer_IPv6_Upstream
238func Test_Proxy_Balancer_IPv6_Upstream(t *testing.T) {
239 t.Parallel()
240
241 target, addr := createProxyTestServerIPv6(t, func(c fiber.Ctx) error {
242 return c.SendStatus(fiber.StatusTeapot)
243 })
244
245 resp, err := target.Test(httptest.NewRequest(fiber.MethodGet, "/", http.NoBody), fiber.TestConfig{
246 Timeout: 2 * time.Second,
247 FailOnTimeout: true,
248 })
249 require.NoError(t, err)
250 require.Equal(t, fiber.StatusTeapot, resp.StatusCode)
251
252 app := fiber.New()
253
254 app.Use(Balancer(Config{Servers: []string{addr}}))
255
256 req := httptest.NewRequest(fiber.MethodGet, "/", http.NoBody)
257 req.Host = addr
258 resp, err = app.Test(req)
259 require.NoError(t, err)
260 require.Equal(t, fiber.StatusInternalServerError, resp.StatusCode)
261}
262
263// go test -run Test_Proxy_Balancer_IPv6_Upstream
264func Test_Proxy_Balancer_IPv6_Upstream_With_DialDualStack(t *testing.T) {

Callers

nothing calls this directly

Calls 6

BalancerFunction · 0.85
TestMethod · 0.80
SendStatusMethod · 0.65
NewMethod · 0.65
UseMethod · 0.65

Tested by

no test coverage detected