fog / fog-vsphere

Fog for vSphere
MIT License
36 stars 63 forks source link

Add boot_order create tests #195

Closed ezr-ondrej closed 2 years ago

ezr-ondrej commented 5 years ago

I made a try for real compute class testing - I feel that it is quite important for the requests testing, but bit difficult as clearly visible from amout of mockstubing compared to actual testing. Got me thinking if we couldn't abstract every command to it's class, but not enough motivation to try by my own without some aprior consensus, so I've tried to push forward at least like this :)

timogoebel commented 5 years ago

+1 for adding tests, especially minitest. We definitely need more here to be more confident we don't break stuff. The mocking is tough to understand. Have you considered using webmock to stub the rbvmomi calls?

Got me thinking if we couldn't abstract every command to it's class,

I don't follow. Please explain. :-)

ezr-ondrej commented 5 years ago

+1 for adding tests, especially minitest. We definitely need more here to be more confident we don't break stuff. The mocking is tough to understand. Have you considered using webmock to stub the rbvmomi calls?

+1 for webmock, probably bit cleaner solution, but doesn't solve that load of dependencies we need to stub before getting on the real testing. I believe it says something about how deeply coupled is actually the code. It would be one webmock per one stub here anyway.

I don't follow. Please explain. :-)

If we could define class per each request command, for not polluting the Fog::Vsphere::Compute::Real. Something like: https://gist.github.com/ezr-ondrej/2b194609864cf10c7de5d650ad9f168b I believe it would help to cleanup the code a bit and the tests would became much simpler as we would test decoupled code.

timogoebel commented 5 years ago

If we could define class per each request command, for not polluting the Fog::Vsphere::Compute::Real. Something like: https://gist.github.com/ezr-ondrej/2b194609864cf10c7de5d650ad9f168b I believe it would help to cleanup the code a bit and the tests would became much simpler as we would test decoupled code.

Yep, that sounds like the best solution to me.