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

Function TestConfigErrors

pkg/config/server_config_test.go:47–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

45}
46
47func TestConfigErrors(t *testing.T) {
48 globalCfg := oc.Global{
49 Config: oc.GlobalConfig{
50 As: 1,
51 RouterId: netip.MustParseAddr("1.1.1.1"),
52 Port: 11179,
53 },
54 }
55
56 for _, tt := range []struct {
57 name string
58 expectedErrors []string
59 cfg *oc.BgpConfigSet
60 }{
61 {
62 name: "peer with a valid peer-group",
63 cfg: &oc.BgpConfigSet{
64 Global: globalCfg,
65 Neighbors: []oc.Neighbor{
66 {
67 Config: oc.NeighborConfig{
68 PeerGroup: "router",
69 NeighborAddress: netip.MustParseAddr("1.1.1.2"),
70 },
71 },
72 },
73 PeerGroups: []oc.PeerGroup{
74 {
75 Config: oc.PeerGroupConfig{
76 PeerGroupName: "router",
77 PeerAs: 2,
78 },
79 },
80 },
81 },
82 },
83 {
84 name: "peer without peer-group",
85 expectedErrors: []string{"Failed to add Peer"},
86 cfg: &oc.BgpConfigSet{
87 Global: globalCfg,
88 Neighbors: []oc.Neighbor{
89 {
90 Config: oc.NeighborConfig{
91 PeerGroup: "not-exists",
92 NeighborAddress: netip.MustParseAddr("1.1.1.2"),
93 },
94 },
95 },
96 },
97 },
98 {
99 name: "policy without a set",
100 expectedErrors: []string{"failed to create routing policy", "failed to set policies"},
101 cfg: &oc.BgpConfigSet{
102 Global: globalCfg,
103 PolicyDefinitions: []oc.PolicyDefinition{
104 {

Callers

nothing calls this directly

Calls 6

ServeMethod · 0.95
StopBgpMethod · 0.95
NewBgpServerFunction · 0.92
LoggerOptionFunction · 0.92
InitialConfigFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…