MCPcopy
hub / github.com/hashicorp/memberlist / TestCreate_protocolVersion

Function TestCreate_protocolVersion

memberlist_test.go:169–201  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestCreate_protocolVersion(t *testing.T) {
170 cases := []struct {
171 name string
172 version uint8
173 err bool
174 }{
175 {"min", ProtocolVersionMin, false},
176 {"max", ProtocolVersionMax, false},
177 // TODO(mitchellh): uncommon when we're over 0
178 //{"uncommon", ProtocolVersionMin - 1, true},
179 {"max+1", ProtocolVersionMax + 1, true},
180 {"min-1", ProtocolVersionMax - 1, false},
181 }
182
183 for _, tc := range cases {
184 t.Run(tc.name, func(t *testing.T) {
185 c := DefaultLANConfig()
186 c.BindAddr = getBindAddr().String()
187 c.ProtocolVersion = tc.version
188
189 m, err := Create(c)
190 if err == nil {
191 require.NoError(t, m.Shutdown())
192 }
193
194 if tc.err && err == nil {
195 t.Fatalf("Should've failed with version: %d", tc.version)
196 } else if !tc.err && err != nil {
197 t.Fatalf("Version '%d' error: %s", tc.version, err)
198 }
199 })
200 }
201}
202
203func TestCreate_secretKey(t *testing.T) {
204 cases := []struct {

Callers

nothing calls this directly

Calls 6

DefaultLANConfigFunction · 0.85
getBindAddrFunction · 0.85
CreateFunction · 0.85
FatalfMethod · 0.80
ShutdownMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…