(c *C)
| 97 | } |
| 98 | |
| 99 | func (s *BackendSuite) TestNewBackendWithOptions(c *C) { |
| 100 | options := HTTPBackendSettings{ |
| 101 | Timeouts: HTTPBackendTimeouts{ |
| 102 | Read: "1s", |
| 103 | Dial: "2s", |
| 104 | TLSHandshake: "3s", |
| 105 | }, |
| 106 | KeepAlive: HTTPBackendKeepAlive{ |
| 107 | Period: "4s", |
| 108 | MaxIdleConnsPerHost: 3, |
| 109 | }, |
| 110 | } |
| 111 | b, err := NewHTTPBackend("b1", options) |
| 112 | c.Assert(err, IsNil) |
| 113 | c.Assert(b.GetId(), Equals, "b1") |
| 114 | |
| 115 | o, err := b.TransportSettings() |
| 116 | c.Assert(err, IsNil) |
| 117 | |
| 118 | c.Assert(o.Timeouts.Read, Equals, time.Second) |
| 119 | c.Assert(o.Timeouts.Dial, Equals, 2*time.Second) |
| 120 | c.Assert(o.Timeouts.TLSHandshake, Equals, 3*time.Second) |
| 121 | |
| 122 | c.Assert(o.KeepAlive.Period, Equals, 4*time.Second) |
| 123 | c.Assert(o.KeepAlive.MaxIdleConnsPerHost, Equals, 3) |
| 124 | } |
| 125 | |
| 126 | func (s *BackendSuite) TestBackendSettingsEq(c *C) { |
| 127 | options := []struct { |
nothing calls this directly
no test coverage detected