Some field names in validation.go not consistent

Fields are (for now) JavaScript style field accessors
pull/6/head
Clayton Coleman 2014-10-02 23:41:02 -04:00
parent d131ad640a
commit 0ff77ffcb3
2 changed files with 6 additions and 6 deletions

View File

@ -164,7 +164,7 @@ func AccumulateUniquePorts(containers []api.Container, accumulator map[int]bool,
continue
}
if accumulator[port] {
cErrs = append(cErrs, errs.NewFieldDuplicate("Port", port))
cErrs = append(cErrs, errs.NewFieldDuplicate("port", port))
} else {
accumulator[port] = true
}
@ -314,7 +314,7 @@ func ValidatePod(pod *api.Pod) errs.ErrorList {
allErrs = append(allErrs, errs.NewFieldRequired("id", pod.ID))
}
if !util.IsDNSSubdomain(pod.Namespace) {
allErrs = append(allErrs, errs.NewFieldInvalid("pod.Namespace", pod.Namespace))
allErrs = append(allErrs, errs.NewFieldInvalid("namespace", pod.Namespace))
}
allErrs = append(allErrs, ValidatePodState(&pod.DesiredState).Prefix("desiredState")...)
return allErrs
@ -329,10 +329,10 @@ func ValidateService(service *api.Service) errs.ErrorList {
allErrs = append(allErrs, errs.NewFieldInvalid("id", service.ID))
}
if !util.IsDNSSubdomain(service.Namespace) {
allErrs = append(allErrs, errs.NewFieldInvalid("service.Namespace", service.Namespace))
allErrs = append(allErrs, errs.NewFieldInvalid("namespace", service.Namespace))
}
if !util.IsValidPortNum(service.Port) {
allErrs = append(allErrs, errs.NewFieldInvalid("Service.Port", service.Port))
allErrs = append(allErrs, errs.NewFieldInvalid("port", service.Port))
}
if len(service.Protocol) == 0 {
service.Protocol = "TCP"
@ -352,7 +352,7 @@ func ValidateReplicationController(controller *api.ReplicationController) errs.E
allErrs = append(allErrs, errs.NewFieldRequired("id", controller.ID))
}
if !util.IsDNSSubdomain(controller.Namespace) {
allErrs = append(allErrs, errs.NewFieldInvalid("controller.Namespace", controller.Namespace))
allErrs = append(allErrs, errs.NewFieldInvalid("namespace", controller.Namespace))
}
allErrs = append(allErrs, ValidateReplicationControllerState(&controller.DesiredState).Prefix("desiredState")...)
return allErrs

View File

@ -626,7 +626,7 @@ func TestValidateReplicationController(t *testing.T) {
field := errs[i].(errors.ValidationError).Field
if !strings.HasPrefix(field, "desiredState.podTemplate.") &&
field != "id" &&
field != "controller.Namespace" &&
field != "namespace" &&
field != "desiredState.replicaSelector" &&
field != "desiredState.replicas" {
t.Errorf("%s: missing prefix for: %v", k, errs[i])