39 lines
856 B
Go
39 lines
856 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", "91.107.211.117"})
|
|
if err != nil {
|
|
t.Errorf("%s", err.Error())
|
|
}
|
|
if expected_ip_pool != got {
|
|
t.Errorf("got %+v, want %+v", got, expected_ip_pool)
|
|
}
|
|
}
|