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

Function TestRandomBalancerWithNoTargets

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

Source from the content-addressed store, hash-verified

433}
434
435func TestRandomBalancerWithNoTargets(t *testing.T) {
436 e := echo.New()
437 req := httptest.NewRequest(http.MethodGet, "/?id=1&name=Jon+Snow", nil)
438 rec := httptest.NewRecorder()
439 c := e.NewContext(req, rec)
440
441 // Assert balancer with empty targets does return `nil` on `Next()`
442 rb := NewRandomBalancer(nil)
443 target, err := rb.Next(c)
444 assert.Nil(t, target)
445 assert.NoError(t, err)
446}
447
448func TestRoundRobinBalancerWithNoTargets(t *testing.T) {
449 // Assert balancer with empty targets does return `nil` on `Next()`

Callers

nothing calls this directly

Calls 3

NewRandomBalancerFunction · 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…