Skip to content

test: add BGP speaker unit and end-to-end coverage - #7241

Merged
zhangzujian merged 5 commits into
kubeovn:masterfrom
zhangzujian:test/bgp-speaker-tests
Aug 17, 2026
Merged

test: add BGP speaker unit and end-to-end coverage#7241
zhangzujian merged 5 commits into
kubeovn:masterfrom
zhangzujian:test/bgp-speaker-tests

Conversation

@zhangzujian

@zhangzujian zhangzujian commented Aug 15, 2026

Copy link
Copy Markdown
Member

What this PR does

Adds focused unit and end-to-end coverage for the classic kube-ovn-speaker BGP implementation.

Unit tests

  • exercise IPv4 route add/withdraw reconciliation against an in-memory GoBGP server
  • verify IPv4, IPv6, and extended-nexthop path construction
  • cover NEXT_HOP and MP_REACH_NLRI extraction
  • cover EIP readiness/annotation filtering and deduplication through the production reconciliation path
  • cover whole-second graceful-restart boundaries and reject sub-second values that would be truncated to zero by GoBGP
  • cover reuse of the startup-selected cached neighbor source address

End-to-end tests

Adds a serial IPv4 Ginkgo suite using the existing Kind + containerlab + FRR topology. It verifies:

  • both speaker sessions become Established
  • a local-policy Pod /32 is learned from its hosting node with the exact expected nexthop and is withdrawn after Pod deletion
  • switching ovn-default between cluster and local reconciles exact Pod/CIDR peer+nexthop paths without restarting speakers
  • an annotated ClusterIP is advertised by both speakers and withdrawn when the annotation is removed
  • FRR paths are read from the full IPv4 unicast RIB because FRR 9.1.3 omits peerId from prefix-specific JSON output

Withdrawal checks require the route path to be absent while both BGP sessions remain Established, so session loss or an invalid/stale retained path cannot produce a false pass.

The suite is wired into e2e-build, a dedicated Make target, and the x86 workflow. Failure artifacts include FRR summary/RIB output, speaker DaemonSet/Pod state and logs, events, audit logs, and kubectl ko log; setup failures upload an explicit unavailable marker when the cluster never becomes usable.

Local verification

All local compile, test, and static-check commands ran with MemoryMax=512M:

  • go test ./pkg/speaker -count=1 -cover (39.9%)
  • go test -race ./pkg/speaker -count=1
  • go vet ./pkg/speaker
  • go test test/e2e/bgp/frr.go test/e2e/bgp/frr_test.go -count=1
  • workflow YAML parse and BGP job wiring assertions
  • git diff --check

The privileged Kind/containerlab E2E and repository golangci-lint are delegated to GitHub Actions.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. go Pull requests that update Go code test automation tests labels Aug 15, 2026
Signed-off-by: Zujian Zhang <zhangzujian.7@gmail.com>
@zhangzujian
zhangzujian force-pushed the test/bgp-speaker-tests branch from 89adee2 to fc625bb Compare August 15, 2026 15:31
@coveralls

coveralls commented Aug 15, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 31926766507

Coverage increased (+0.3%) to 32.744%

Details

  • Coverage increased (+0.3%) from the base build.
  • Patch coverage: 11 of 11 lines across 1 file are fully covered (100%).
  • 4 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

4 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
pkg/bfddsupervisor/socket.go 2 51.58%
pkg/ovs/ovn-nb-bfd.go 2 61.61%

Coverage Stats

Coverage Status
Relevant Lines: 64588
Covered Lines: 21149
Line Coverage: 32.74%
Coverage Strength: 0.38 hits per line

💛 - Coveralls

Signed-off-by: Zujian Zhang <zhangzujian.7@gmail.com>
Signed-off-by: Zujian Zhang <zhangzujian.7@gmail.com>
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Aug 16, 2026
Signed-off-by: Zujian Zhang <zhangzujian.7@gmail.com>
@zhangzujian
zhangzujian force-pushed the test/bgp-speaker-tests branch from 6c0e70d to d418cc2 Compare August 16, 2026 03:53
Signed-off-by: Zujian Zhang <zhangzujian.7@gmail.com>
@zhangzujian
zhangzujian force-pushed the test/bgp-speaker-tests branch from 6c4d45e to 3b88677 Compare August 16, 2026 04:29
@zhangzujian
zhangzujian merged commit 36d67b7 into kubeovn:master Aug 17, 2026
84 checks passed
@zhangzujian
zhangzujian deleted the test/bgp-speaker-tests branch August 17, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code size:M This PR changes 30-99 lines, ignoring generated files. test automation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants