Skip to content

Commit

Permalink
Fixed --volumes validation
Browse files Browse the repository at this point in the history
Now, `--volumes` argument will validate it's input, it will only allow
`persistentVolumeClaim` or `emptyDir`, otherwise it will throw an error.
  • Loading branch information
surajnarwade committed Sep 20, 2017
1 parent 99f88ef commit fdbe867
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ func ValidateFlags(bundle string, args []string, cmd *cobra.Command, opt *kobjec
if opt.GenerateJSON && opt.GenerateYaml {
log.Fatalf("YAML and JSON format cannot be provided at the same time")
}

if opt.Volumes != "persistentVolumeClaim" && opt.Volumes != "emptyDir" {
log.Fatal("Unknown Volume type: ", opt.Volumes, ", possible values are: persistentVolumeClaim and emptyDir")
}
}

// ValidateComposeFile validated the compose file provided for conversion
Expand Down
2 changes: 1 addition & 1 deletion pkg/loader/compose/compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestParseHealthCheck(t *testing.T) {
}

if !reflect.DeepEqual(output, expected) {
t.Errorf("Structs are not equal, expected: %s, output: %s", expected, output)
t.Errorf("Structs are not equal, expected: %v, output: %v", expected, output)
}
}

Expand Down

0 comments on commit fdbe867

Please sign in to comment.