Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed --volumes validation #817

Merged
merged 1 commit into from
Sep 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 3 additions & 0 deletions script/test/cmd/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ cmd="kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/dock
sed -e "s;%VERSION%;$version;g" -e "s;%CMD%;$cmd;g" $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/output-k8s-empty-vols-template.json > /tmp/output-k8s.json
convert::expect_success_and_warning "kompose convert -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yml --stdout -j --volumes emptyDir" "/tmp/output-k8s.json" "Volume mount on the host "\"."\" isn't supported - ignoring path on the host"

#Failing test for `--volumes` option
convert::expect_failure "kompose convert --stdout -j -f $KOMPOSE_ROOT/script/test/fixtures/change-in-volume/docker-compose.yaml --volumes foobar"

# Test related to support docker-compose.yaml beside docker-compose.yml
# Store the original path
CURRENT_DIR=$(pwd)
Expand Down