MCPcopy
hub / github.com/dropbox/godropbox / TestRetries

Method TestRetries

net2/http2/load_balanced_pool_test.go:163–194  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

161}
162
163func (s *LoadBalancedPoolSuite) TestRetries(c *C) {
164 server, addr := test_utils.SetupTestServer(false)
165 defer server.Close()
166
167 params := DefaultLoadBalancedPoolParams()
168 params.ConnParams.MaxIdle = 1
169 params.ConnParams.ResponseTimeout = 100 * time.Millisecond
170 pool := NewLoadBalancedPool(params)
171 infos := []LBPoolInstanceInfo{
172 {
173 Addr: addr,
174 InstanceId: 0,
175 },
176 {
177 Addr: "127.0.0.1:1111",
178 InstanceId: 1,
179 },
180 }
181 pool.Update(infos)
182
183 simplePool, err := pool.GetInstancePool(1)
184 c.Assert(err, IsNil)
185 c.Assert(simplePool.addr, Equals, "127.0.0.1:1111")
186
187 for i := 0; i < 10; i++ {
188 // no requests should ever fail, because of retries and mark downs
189 req, err := http.NewRequest("GET", "/", nil)
190 c.Assert(err, IsNil)
191 _, err = pool.Do(req)
192 c.Assert(err, IsNil)
193 }
194}
195
196func (s *LoadBalancedPoolSuite) TestConnectTimeout(c *C) {
197 params := DefaultLoadBalancedPoolParams()

Callers

nothing calls this directly

Calls 7

UpdateMethod · 0.95
GetInstancePoolMethod · 0.95
DoMethod · 0.95
SetupTestServerFunction · 0.92
NewLoadBalancedPoolFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected