@@ -2122,6 +2122,47 @@ func TestRpaasInstanceController_Reconcile_Suspended(t *testing.T) {
2122
2122
assert .Equal (t , "Warning RpaasInstanceSuspended no modifications will be done by RPaaS controller" , <- fr .Events )
2123
2123
}
2124
2124
2125
+ func TestExternalAddresssesFromNginx (t * testing.T ) {
2126
+ externalAddresses := externalAddresssesFromNginx (& nginxv1alpha1.Nginx {
2127
+ Status : nginxv1alpha1.NginxStatus {
2128
+ Ingresses : []nginxv1alpha1.IngressStatus {
2129
+ {
2130
+ Name : "ing1" ,
2131
+ IPs : []string {"1.1.1.3" , "1.1.1.1" },
2132
+ },
2133
+ {
2134
+ Name : "ing2" ,
2135
+ IPs : []string {"1.1.1.2" , "1.1.1.4" },
2136
+ },
2137
+ {
2138
+ Name : "ing3" ,
2139
+ Hostnames : []string {"host2" , "host1" },
2140
+ },
2141
+ },
2142
+ Services : []nginxv1alpha1.ServiceStatus {
2143
+ {
2144
+ Name : "svc" ,
2145
+ IPs : []string {"8.1.1.3" , "8.1.1.1" },
2146
+ },
2147
+ {
2148
+ Name : "svc2" ,
2149
+ IPs : []string {"8.1.1.2" , "8.1.1.4" },
2150
+ },
2151
+ {
2152
+ Name : "svc3" ,
2153
+ Hostnames : []string {"host9" , "host8" },
2154
+ },
2155
+ },
2156
+ },
2157
+ })
2158
+
2159
+ assert .Equal (t , v1alpha1.RpaasInstanceExternalAddressesStatus {
2160
+ IPs : []string {"1.1.1.1" , "1.1.1.2" , "1.1.1.3" , "1.1.1.4" , "8.1.1.1" , "8.1.1.2" , "8.1.1.3" , "8.1.1.4" },
2161
+ Hostnames : []string {"host1" , "host2" , "host8" , "host9" },
2162
+ }, externalAddresses )
2163
+
2164
+ }
2165
+
2125
2166
func newRpaasInstanceReconciler (objs ... runtime.Object ) * RpaasInstanceReconciler {
2126
2167
return & RpaasInstanceReconciler {
2127
2168
Client : fake .NewClientBuilder ().WithScheme (extensionsruntime .NewScheme ()).WithRuntimeObjects (objs ... ).Build (),
0 commit comments