feature/tt/initial-implementation (#1)
Reviewed-on: #1 Co-authored-by: Tobias Trabelsi <lerentis@uploadfilter24.eu> Co-committed-by: Tobias Trabelsi <lerentis@uploadfilter24.eu>
This commit is contained in:
38
internal/k8s_test.go
Normal file
38
internal/k8s_test.go
Normal file
@@ -0,0 +1,38 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user