Skip to content

Commit

Permalink
Merge pull request #211 from procrypt/unknown_args
Browse files Browse the repository at this point in the history
remove unknown args and added tests
  • Loading branch information
kadel authored Oct 26, 2016
2 parents 7435f82 + 1c30921 commit 414645d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cli/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func validateFlags(c *cli.Context, opt *kobject.ConvertOptions) {
if len(dabFile) > 0 && c.GlobalIsSet("file") {
logrus.Fatalf("Error: 'compose' file and 'dab' file cannot be specified at the same time")
}

if len(c.Args()) != 0 {
logrus.Fatal("Unknown Argument(s): ", strings.Join(c.Args(), ","))
}
}

func validateControllers(opt *kobject.ConvertOptions) {
Expand Down
6 changes: 6 additions & 0 deletions script/test/cmd/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,10 @@ convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_RO
# kubernetes test
convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtures/envvars-separators/docker-compose.yml convert --stdout" "$KOMPOSE_ROOT/script/test/fixtures/envvars-separators/output-k8s.json"

######
# Tests related to unknown arguments with cli commands
convert::expect_failure "kompose up $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml" "Unknown Argument docker-gitlab.yml"
convert::expect_failure "kompose down $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml" "Unknown Argument docker-gitlab.yml"
convert::expect_failure "kompose convert $KOMPOSE_ROOT/script/test/fixtures/gitlab/docker-compose.yml" "Unknown Argument docker-gitlab.yml"

exit $EXIT_STATUS

0 comments on commit 414645d

Please sign in to comment.