docs: enhance EvoBGP architecture plan with new risk mitigation strategies, testing matrix for BIRD2, and CI/CD workflow details. Updated section titles for clarity and added completed todos for deployment practices.
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package birdfmt
|
||||
|
||||
import (
|
||||
"path"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBirdScenarioPaths_Table(t *testing.T) {
|
||||
paths, err := BirdScenarioPaths()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Expected scenario leaf names — extend when adding directories under testdata/scenarios.
|
||||
wantNames := []string{
|
||||
"bgp_dual_peer",
|
||||
"bgp_ipv4_peer",
|
||||
"bgp_ipv6_peer",
|
||||
"domains_resolved",
|
||||
"empty_static",
|
||||
"filter_export",
|
||||
"large_prefix_list",
|
||||
"mixed_static_bgp",
|
||||
"minimal",
|
||||
"static_ipv4",
|
||||
"with_include",
|
||||
}
|
||||
var gotNames []string
|
||||
for _, p := range paths {
|
||||
gotNames = append(gotNames, path.Base(p))
|
||||
}
|
||||
slices.Sort(gotNames)
|
||||
if !slices.Equal(gotNames, wantNames) {
|
||||
t.Fatalf("scenario set drift: got %v want %v", gotNames, wantNames)
|
||||
}
|
||||
|
||||
for _, p := range paths {
|
||||
t.Run(path.Base(p), func(t *testing.T) {
|
||||
b, err := ReadScenarioBirdConf(p)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(b) == 0 {
|
||||
t.Fatal("empty bird.conf")
|
||||
}
|
||||
if !strings.Contains(string(b), "router id") {
|
||||
t.Fatal("expected router id in scenario")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepoRelativeBirdConf_Table(t *testing.T) {
|
||||
paths, err := BirdScenarioPaths()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, p := range paths {
|
||||
rel := RepoRelativeBirdConf(p)
|
||||
if !strings.HasPrefix(rel, "internal/birdfmt/") {
|
||||
t.Fatalf("%s: bad prefix %q", p, rel)
|
||||
}
|
||||
if !strings.HasSuffix(rel, "/bird.conf") {
|
||||
t.Fatalf("%s: expected .../bird.conf, got %q", p, rel)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user