Merge pull request #211 from procrypt/unknown_args

remove unknown args and added tests
This commit is contained in:
Tomas Kral 2016-10-26 14:37:08 +02:00 committed by GitHub
commit 414645d73c
2 changed files with 10 additions and 0 deletions

View File

@ -74,6 +74,10 @@ func validateFlags(c *cli.Context, opt *kobject.ConvertOptions) {
if len(dabFile) > 0 && c.GlobalIsSet("file") { if len(dabFile) > 0 && c.GlobalIsSet("file") {
logrus.Fatalf("Error: 'compose' file and 'dab' file cannot be specified at the same time") 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) { func validateControllers(opt *kobject.ConvertOptions) {

View File

@ -72,4 +72,10 @@ convert::expect_success_and_warning "kompose --provider=openshift -f $KOMPOSE_RO
# kubernetes test # 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" 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 exit $EXIT_STATUS