Skip to content

Commit

Permalink
Fix examples test by setting a context prior to validation
Browse files Browse the repository at this point in the history
  • Loading branch information
derekwaynecarr committed Oct 1, 2014
1 parent 0312d80 commit e032c30
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
)

func validateObject(obj runtime.Object) (errors []error) {
ctx := api.NewDefaultContext()
switch t := obj.(type) {
case *api.ReplicationController:
errors = validation.ValidateManifest(&t.DesiredState.PodTemplate.DesiredState.Manifest)
Expand All @@ -40,12 +41,14 @@ func validateObject(obj runtime.Object) (errors []error) {
errors = append(errors, validateObject(&t.Items[i])...)
}
case *api.Service:
api.ValidNamespaceOnCreateOrUpdate(ctx, &t.JSONBase)
errors = validation.ValidateService(t)
case *api.ServiceList:
for i := range t.Items {
errors = append(errors, validateObject(&t.Items[i])...)
}
case *api.Pod:
api.ValidNamespaceOnCreateOrUpdate(ctx, &t.JSONBase)
errors = validation.ValidateManifest(&t.DesiredState.Manifest)
case *api.PodList:
for i := range t.Items {
Expand Down

0 comments on commit e032c30

Please sign in to comment.