CI / changes (push) Successful in 8s
CI / openapi (push) Has been skipped
CI / go (push) Successful in 40s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Has been skipped
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Has been skipped
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Successful in 15s
CI / docker-go-prime (push) Successful in 24s
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Successful in 59s
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Successful in 2m18s
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Successful in 1m23s
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Successful in 1m20s
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Successful in 1m24s
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Successful in 1m9s
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Successful in 1m22s
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Successful in 1m24s
Updated the `startBirdMetricsPoller` function to accept a context parameter, allowing for better control over the polling lifecycle. This change was applied in both `evobgp-all` and `evobgp-api` main files. Additionally, modified the `StartBirdProtocolsPoller` function to handle context cancellation, ensuring graceful shutdown of the polling routine. Introduced a new service in the Docker Compose configuration for logging runtime service outputs, improving observability during deployment.
51 lines
1.0 KiB
Go
51 lines
1.0 KiB
Go
package pipeline
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestExtractCIDRs_JSONNested(t *testing.T) {
|
|
body := `{"a":{"b":{"c":"192.0.2.0/24"}}}`
|
|
pfx, err := ExtractCIDRs(body, "json", "a.b.c")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(pfx) != 1 || pfx[0].String() != "192.0.2.0/24" {
|
|
t.Fatalf("got %#v", pfx)
|
|
}
|
|
}
|
|
|
|
func TestExtractCIDRs_JSONDepthLimit(t *testing.T) {
|
|
var b strings.Builder
|
|
b.WriteString(`{"x":`)
|
|
for i := 0; i < maxJSONWalkDepth+4; i++ {
|
|
b.WriteString(`{"k":`)
|
|
}
|
|
b.WriteString(`"192.0.2.1"`)
|
|
for i := 0; i < maxJSONWalkDepth+4; i++ {
|
|
b.WriteByte('}')
|
|
}
|
|
b.WriteByte('}')
|
|
_, err := ExtractCIDRs(b.String(), "json", "")
|
|
if err == nil {
|
|
t.Fatal("expected depth error")
|
|
}
|
|
}
|
|
|
|
func TestExtractCIDRs_JSONPathBreadth(t *testing.T) {
|
|
var b strings.Builder
|
|
b.WriteString(`{"items":{"x":[`)
|
|
for i := 0; i < maxJSONPathBreadth+1; i++ {
|
|
if i > 0 {
|
|
b.WriteByte(',')
|
|
}
|
|
b.WriteString(`"192.0.2.0/24"`)
|
|
}
|
|
b.WriteString(`]}}`)
|
|
_, err := ExtractCIDRs(b.String(), "json", "items.x[]")
|
|
if err == nil {
|
|
t.Fatal("expected breadth error")
|
|
}
|
|
}
|