rewrite to ippool patcher
This commit is contained in:
@@ -4,37 +4,35 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGenerateCRD(t *testing.T) {
|
||||
expected := `
|
||||
func TestGenerateIpPoolCRD(t *testing.T) {
|
||||
expected_ip_pool := `
|
||||
{
|
||||
"apiVersion": "externaldns.k8s.io/v1alpha1",
|
||||
"kind": "DNSEndpoint",
|
||||
"apiVersion": "cilium.io/v2alpha1",
|
||||
"kind": "CiliumLoadBalancerIPPool",
|
||||
"metadata": {
|
||||
"name": "test",
|
||||
"name": "covidnetes-pool",
|
||||
"annotations": {
|
||||
"external.dns/provider": "cf"
|
||||
"argocd.argoproj.io/tracking-id": "cilium-lb:cilium.io/CiliumLoadBalancerIPPool:kube-system/covidnetes-pool"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"endpoints": [
|
||||
"blocks": [
|
||||
{
|
||||
"dnsName": "mail",
|
||||
"recordTTL": 180,
|
||||
"recordType": "A",
|
||||
"targets": [
|
||||
"192.168.0.1",
|
||||
"192.168.0.2",
|
||||
]
|
||||
"cidr": "49.13.48.9/32"
|
||||
},
|
||||
{
|
||||
"cidr": "91.107.211.117/32"
|
||||
}
|
||||
]
|
||||
],
|
||||
"disabled": false
|
||||
}
|
||||
}
|
||||
`
|
||||
got, err := generateCrd("test", []string{"192.168.0.1", "192.168.0.2"})
|
||||
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 != got {
|
||||
t.Errorf("got %+v, want %+v", got, expected)
|
||||
if expected_ip_pool != got {
|
||||
t.Errorf("got %+v, want %+v", got, expected_ip_pool)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user