redhat-developer / opencompose

OpenCompose - A higher level abstraction for Kubernetes Resource
Apache License 2.0
64 stars 12 forks source link

abstract out validate() method for object.Mount #147

Closed concaf closed 7 years ago

concaf commented 7 years ago

This abstracts out the validate() methoud for Mount type in object.go, as has been done for other types in the file.

Also, added relevant tests.

Fixes #142

kadel commented 7 years ago

Ah :rofl: This is similar to what I suggested to @surajssd while reviewing his volumes PR. see https://github.com/redhat-developer/opencompose/pull/88#discussion_r112960763

kadel commented 7 years ago

I agree with basic idea, but i think that you shouldn't pass allMounts as argument to function. Its required only for checking colliding paths. And that one chack can be done in (c *Container) validate(). as it requires information form container, its kind of container validation. (m *Mount) validate() error should validate only single mount nothing more.

concaf commented 7 years ago

@kadel agreed, fixed, PTAL :)

kadel commented 7 years ago

This is exactly how I was imagining it ;-) What do you thing @surajssd ?