MCPcopy
hub / github.com/osrg/gobgp / Test_NewBfdConfigFromAPIStructRejectsOverflow

Function Test_NewBfdConfigFromAPIStructRejectsOverflow

pkg/server/bfd_server_test.go:101–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

99}
100
101func Test_NewBfdConfigFromAPIStructRejectsOverflow(t *testing.T) {
102 assert := assert.New(t)
103
104 _, err := newBfdConfigFromAPIStruct(&api.BfdPeerConfig{Port: 1 << 16})
105 assert.Error(err)
106
107 _, err = newBfdConfigFromAPIStruct(&api.BfdPeerConfig{DetectionMultiplier: 1 << 8})
108 assert.Error(err)
109
110 config, err := newBfdConfigFromAPIStruct(&api.BfdPeerConfig{
111 Enabled: true,
112 Port: BfdServerPort,
113 DetectionMultiplier: 3,
114 })
115 assert.NoError(err)
116 assert.True(config.Enabled)
117 assert.Equal(uint16(BfdServerPort), config.Port)
118 assert.Equal(uint8(3), config.DetectionMultiplier)
119}
120
121func newServer(port uint16) *bfdServer {
122 ps := &mockPeerState{}

Callers

nothing calls this directly

Calls 3

ErrorMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…