MCPcopy
hub / github.com/vulcand/vulcand / TestNewBackendWithOptions

Method TestNewBackendWithOptions

engine/model_test.go:99–124  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

97}
98
99func (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
126func (s *BackendSuite) TestBackendSettingsEq(c *C) {
127 options := []struct {

Callers

nothing calls this directly

Calls 3

NewHTTPBackendFunction · 0.85
GetIdMethod · 0.45
TransportSettingsMethod · 0.45

Tested by

no test coverage detected