Files
canada-kaktus/internal/k8s_test.go

39 lines
862 B
Go

package internal
import (
"testing"
)
func TestGenerateIpPoolCRD(t *testing.T) {
expected_ip_pool := `
{
"apiVersion": "cilium.io/v2alpha1",
"kind": "CiliumLoadBalancerIPPool",
"metadata": {
"name": "covidnetes-pool",
"annotations": {
"argocd.argoproj.io/tracking-id": "cilium-lb:cilium.io/CiliumLoadBalancerIPPool:kube-system/covidnetes-pool"
}
},
"spec": {
"blocks": [
{
"cidr": "49.13.48.9/32"
},
{
"cidr": "91.107.211.117/32"
}
],
"disabled": false
}
}
`
got, err := generateIpPool("covidnetes-pool", []string{"49.13.48.9/32", "91.107.211.117/32"})
if err != nil {
t.Errorf("%s", err.Error())
}
if expected_ip_pool != got {
t.Errorf("got %+v, want %+v", got, expected_ip_pool)
}
}