MCPcopy
hub / github.com/labstack/echo / TestRoundRobinBalancerWithNoTargets

Function TestRoundRobinBalancerWithNoTargets

middleware/proxy_test.go:448–459  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

446}
447
448func TestRoundRobinBalancerWithNoTargets(t *testing.T) {
449 // Assert balancer with empty targets does return `nil` on `Next()`
450 rrb := NewRoundRobinBalancer([]*ProxyTarget{})
451 e := echo.New()
452 req := httptest.NewRequest(http.MethodGet, "/?id=1&name=Jon+Snow", nil)
453 rec := httptest.NewRecorder()
454 c := e.NewContext(req, rec)
455
456 target, err := rrb.Next(c)
457 assert.Nil(t, target)
458 assert.NoError(t, err)
459}
460
461func TestProxyWithNoTargetReturnsBadGateway(t *testing.T) {
462 targetURL, _ := url.Parse("http://127.0.0.1:8080")

Callers

nothing calls this directly

Calls 3

NewRoundRobinBalancerFunction · 0.85
NewContextMethod · 0.80
NextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…