quality / commitlint (push) Skipped
quality / changes (push) Successful in 8s
quality / docker-check (push) Skipped
quality / openapi (push) Successful in 26s
quality / web (push) Successful in 1m27s
quality / go (push) Successful in 1m18s
quality / bird2 (push) Successful in 16s
CD / quality (push) Successful in 3m43s
CD / publish (push) Successful in 3m11s
- Enhanced the speaker installation documentation to clarify the use of TCP port 179 and the logging commands for monitoring BIRD and evobgp-agent. - Updated the speaker form dialog to include additional information about MikroTik connections and logging commands. - Modified the BIRD configuration to include logging to stderr for better visibility during operations. - Adjusted the Docker Compose configuration to ensure proper network settings and sysctl configurations for BGP functionality.
72 lines
1.7 KiB
Go
72 lines
1.7 KiB
Go
package speakerinstall
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestBuild_includesTraefikDNS01(t *testing.T) {
|
|
res, err := Build(Params{
|
|
SpeakerID: "11111111-1111-1111-1111-111111111111",
|
|
AgentSecret: "secret-abc",
|
|
NodeToken: "node-tok",
|
|
BundlePubkey: "pubkey==",
|
|
ControlPlaneURL: "https://cp.example.com",
|
|
AgentDomain: "bgp-dc2.example.com",
|
|
LetsEncryptEmail: "ops@example.com",
|
|
CFDNSAPIToken: "cf-token-xyz",
|
|
PanelIPWhitelist: "203.0.113.1/32",
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
cmd := res.DockerCommands
|
|
for _, want := range []string{
|
|
"traefik",
|
|
"dnschallenge=true",
|
|
"dnschallenge.provider=cloudflare",
|
|
"CF_DNS_API_TOKEN",
|
|
"cf-token-xyz",
|
|
"Host(`bgp-dc2.example.com`)",
|
|
"secret-abc",
|
|
"node-tok",
|
|
"https://cp.example.com",
|
|
"docker compose up -d",
|
|
"sysctl -w net.ipv4.ip_forward=1",
|
|
"evobgp_speaker_traefik_letsencrypt",
|
|
`"179:179/tcp"`,
|
|
"net.ipv4.ip_forward: \"1\"",
|
|
} {
|
|
if !strings.Contains(cmd, want) {
|
|
t.Errorf("docker_commands missing %q", want)
|
|
}
|
|
}
|
|
if strings.Contains(cmd, "network_mode: host") {
|
|
t.Error("replica bird2 must not use network_mode: host")
|
|
}
|
|
if strings.Contains(cmd, "?set ") {
|
|
t.Error("compose must bake values, not ${VAR:?set VAR}")
|
|
}
|
|
if res.ComposeYAML == "" {
|
|
t.Fatal("compose_yaml empty")
|
|
}
|
|
}
|
|
|
|
func TestBuild_placeholdersWhenEmpty(t *testing.T) {
|
|
res, err := Build(Params{SpeakerID: "id", AgentSecret: "s", NodeToken: "t", BundlePubkey: "p"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, ph := range []string{
|
|
placeholderAgentDomain,
|
|
placeholderLetsEncryptEmail,
|
|
placeholderCFDNSToken,
|
|
placeholderPanelIP,
|
|
placeholderControlPlaneURL,
|
|
} {
|
|
if !strings.Contains(res.DockerCommands, ph) {
|
|
t.Errorf("expected placeholder %s", ph)
|
|
}
|
|
}
|
|
}
|