Files
EvoBGP/internal/birdfmt/protocol_summary_test.go
T
Denozordec 399622cc70
CI / changes (push) Successful in 5s
CI / openapi (push) Has been skipped
CI / go (push) Successful in 23s
CI / bird2 (push) Has been cancelled
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Has been cancelled
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Has been cancelled
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Has been cancelled
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Has been cancelled
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Has been cancelled
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Has been cancelled
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Has been cancelled
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Has been cancelled
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Has started running
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Has been cancelled
CI / docker-bird (push) Has been cancelled
feat: improve BGP protocol summary handling by introducing isBGPProtocolSummaryRow function. Update SummarizeProtocolsOutput and related tests to ensure evobgp_* static names are not counted as BGP sessions, enhancing accuracy in protocol summaries.
2026-04-06 00:41:59 +07:00

26 lines
823 B
Go

package birdfmt
import "testing"
func TestSummarizeProtocolsOutput(t *testing.T) {
sample := `name proto table state since info
device1 Device --- up 10:00:00
uplink BGP --- start 10:00:01 Established
`
s := SummarizeProtocolsOutput(sample)
if s.BGPSessionsTotal != 1 || s.BGPEstablished != 1 {
t.Fatalf("got %+v", s)
}
}
func TestSummarizeProtocolsOutput_evoBGPNameNotCountedAsBGP(t *testing.T) {
sample := `Name Proto Table State Since Info
evobgp_prefixes_v4 Static master4 up 17:32:14.631
evobgp_prefixes_v6 Static master6 up 17:32:14.631
`
s := SummarizeProtocolsOutput(sample)
if s.BGPSessionsTotal != 0 || s.BGPEstablished != 0 {
t.Fatalf("evobgp_* static names must not match substring bgp: got %+v", s)
}
}