Open HashNotAdam opened 7 years ago
@HashNotAdam Thats a great PR. I'm really excited to merge it in.
Could you just fix @houndci-bot comments and the one i made regarding the name of the method before i push this forward please?
NP @plribeiro3000
In reviewing your comments, I've found a bug in load_data
which tells me there is no test for the original code so I'll look at that too.
@plribeiro3000, when attempting to add a test for the above-mentioned bug, I encountered a few issues.
Firstly, Fog::Compute::XenServer::Real
deals with making server connections. I can see there are a few VCR cassettes that exist that were configured for connecting to a local server, however, I was unable to see any documentation regarding how one might start a server for testing. Without a test server, mock, or cassette, I can't be completely certain that there aren't more bugs.
The second issue is related to the first in that I found there is a huge amount of duplication in this class, however, given the lack of tests, I can't safely refactor. As an example, the method I created from existing code (request_get_all_records
) is nearly identical to get_records
. Also, most of the request files just make a call to @connection.request
using the parser Fog::Parsers::XenServer::Base.new
.
If you can provide assistance regarding how I could get a suitable test environment or equivalent, I'd be happy to continue refactoring. If not, I'll just clean up what I've already submitted and leave it there.
@HashNotAdam Sadly there isn't a documentation regarding testing because even the tests were never finished. Those VCR
tests were made using a real XenServer installation on a physical server.
Feel free to let this change off for now so we can merge what you already have and later (another PR) we can tackle this. What do you think?
Thanks @plribeiro3000, that sounds good; I'm far too nervous about playing with code I have no way of testing. If anyone comes up with a way to produce a test environment in the future, I'd be happy jump back in.
@HashNotAdam Can you confirm nothing broke with those changes?
@plribeiro3000 no, as mentioned above, I know of at least one bug so I need to do a clean up and then I'll let you know when I believe it is good.
TBH, even then, if there are no tests, there is no way to be 100% certain.
@HashNotAdam Thats ok to not work. hehehhe We can do a release candidate to be sure. =)
Let me know when we can move forward with this.
TODO
Fog::Compute::XenServer::Models::ClassMethods.define_methods
has a note about how it could be better designed if not for Ruby 1.8.7 but I couldn't see a test that could explain the use case. Hopefully someone else can help with this.