configurator: add test for invalid IP range format
Adds a test that fails IP ranges of the form
a.b.c.d, because the expected range should be
of the form a.b.c.d/x.
@@ -322,6 +322,20 @@ func TestValidateFields(t *testing.T) {
Result: &metav1.Status{Reason: ""},
},
},
+ {
+ testName: "Reject configmap with invalid syntax for IP range",
+ configMap: corev1.ConfigMap{
+ Data: map[string]string{
+ "outbound_ip_range_exclusion_list": "1.1.1.1", // invalid syntax, must be 1.1.1.1/32
+ },
+ },
+ expRes: &v1beta1.AdmissionResponse{
+ Allowed: false,
+ Result: &metav1.Status{
+ Reason: mustBeValidIPRange,
+ },
+ },
+ },
{
testName: "Reject configmap with invalid outbound IP range exclusions",
configMap: corev1.ConfigMap{
