Skip to content

Commit

Permalink
E2E: add test for the unnumbered BGP peering
Browse files Browse the repository at this point in the history
The test requires point-to-point connection so we cannot use any
existing infra peer. Therefore a new peer (docker container)
runs with no network, and point-to-point connections are created using
`sudo ip` commands.

There are three specs
```
Unnumbered BGP session is established and routes are verified iBGP
Unnumbered BGP session is established and routes are verified eBGP
Unnumbered eBGP with BFD peering with native config should be validated
```

A new checking route function is added that executes directly on container
`ip {-4,-6} --json ip route show proto bgp dev net0` command it returns
a `map[netip.Prefix]map[netip.Addr]`. The use of netip.{prefix,addr}
allows direct comparison and no extra loop logic is needed. The output
is also more clear when fails, for example
```
  Unexpected error:
      <*errors.errorString | 0xc000069780>:
      want map[2.2.1.0/24:map[fe80::b4d8:92ff:fe73:1c5a:{}] ...
       got map[2.2.2.0/24:map[fe80::b4d8:92ff:fe73:1c5a:{}] ...
       diff   map[netip.Prefix]map[netip.Addr]struct{}{
      -         s"2.2.1.0/24": {s"fe80::b4d8:92ff:fe73:1c5a": {}},
      +         s"2.2.2.0/24": {s"fe80::b4d8:92ff:fe73:1c5a": {}},
        }
```

The test is implemented in way that parallel run is allowed (-p in
ginkgo), in case we want to start run e2e in parallel.

Signed-off-by: karampok <karampok@gmail.com>
  • Loading branch information
karampok committed Dec 4, 2024
1 parent 2b0d9af commit d18fcf1
Show file tree
Hide file tree
Showing 8 changed files with 569 additions and 115 deletions.
1 change: 1 addition & 0 deletions e2etests/e2etest_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func handleFlags() {
runOnHost = true
}
dump.ReportPath = reportPath
tests.FRRImage = frrImage
}

func TestMain(m *testing.M) {
Expand Down
49 changes: 39 additions & 10 deletions e2etests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,40 @@ toolchain go1.22.4

replace (
github.com/metallb/frr-k8s => ../
go.universe.tf/e2etest => github.com/metallb/metallb/e2etest v0.0.0-20240715121012-af3c10d65f18
go.universe.tf/e2etest => github.com/karampok/metallb/e2etest v0.0.0-20241204133905-1d918d641ee8
go.universe.tf/metallb => github.com/metallb/metallb v0.14.5
)

require (
github.com/metallb/frr-k8s v0.0.11
github.com/google/go-cmp v0.6.0
github.com/metallb/frr-k8s v0.0.16
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/openshift-kni/k8sreporter v1.0.4
github.com/prometheus/client_model v0.6.1
github.com/prometheus/common v0.55.0
go.universe.tf/e2etest v0.0.0-00010101000000-000000000000
k8s.io/api v0.31.0
k8s.io/apimachinery v0.31.0
k8s.io/client-go v0.31.0
k8s.io/api v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/client-go v0.31.1
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
sigs.k8s.io/controller-runtime v0.19.0
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
Expand All @@ -43,46 +50,68 @@ require (
github.com/golang/glog v1.0.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20240525223248-4bfdf5a9a2af // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/moby/spdystream v0.4.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.universe.tf/metallb v0.13.7 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.22.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.31.0 // indirect
k8s.io/component-base v0.31.0 // indirect
k8s.io/apiextensions-apiserver v0.31.1 // indirect
k8s.io/cli-runtime v0.31.1 // indirect
k8s.io/component-base v0.31.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240521193020-835d969ad83a // indirect
k8s.io/pod-security-admission v0.28.4 // indirect
k8s.io/kubectl v0.31.1 // indirect
k8s.io/pod-security-admission v0.31.1 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.17.2 // indirect
sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/karampok/metallb/e2etest => /home/kka/workspace/github.com/metallb/wts/metallb-e2e-unnumber-bfd
Loading

0 comments on commit d18fcf1

Please sign in to comment.