-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[google] Fix Google Engine tests #2509
Conversation
@icco I've found interesting bug/feature in GCE REST API. Different types of requests are using different object representations in fields with the same names: for instance Instances#get will return URL-like compute.services.each { |s| s.reset } , you will get this error:
|
So I've put this fast solution here: https://github.com/allomov/fog/blob/e809e0ef567c1e514b3a360553aacce0242e59c6/lib/fog/google/helpers/attribute_convertor.rb |
end | ||
operation | ||
operation = service.operations.new(service.delete_disk(name, zone_name).body) | ||
operation.wait_for { ready? } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slightly different then what currently exists. To be the same it should be operation.wait_for { !pending? }
.
As for the zones bug, we've come across that before. I had gone through any made it so all requests at the time took just a zone name from our perspective and tweaked it to fit the API. It looks like some of that got deleted (doh). The key when reading the docs is if it wants a zone resource, you give it the full URL, and if it just wants the zone name, then you do that. The best place to do this is in the request. In a perfect world, a user would pass in either a url or a shortened zone name into the model, and the request would clean it up and make it perfect. |
@icco I don't like the idea to have undetermined value format inside |
I see this solutions:
|
request :set_metadata | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: delete extra line.
@allomov, I don't think I understand what you're trying to do with the converter or what you're saying about zones. The model is the user interface, we take in data from the user, validate it and pass it on to the request, which builds the request and sends it off to GCE. We shouldn't care what the user passes into our model, as long as we are consistent with what we return to them. Maybe write a test explaining the bug and the desired outcome? |
@icco I think this illustrates what I am trying to do: https://github.com/Altoros/bosh/blob/google-cpi/bosh_google_cpi/spec/integration/remove_all_instances_spec.rb#L54-L56
If you use instance that is creates by But the problem is that zone URL is stored in |
@icco I strongly recommend to distinguish |
so, my point is that we shouldn't need to show the zone url to users. The zone name is just a shortened representation of the zone url. I personally like how we do it in Disk, and would love if that was consistent across the project. At one point it was, but over time I guess we've gotten sloppy. I guess my problem with the converter is it doesn't make much sense to me and seems far too generic. When else would you use something like that? Why not just put it into the zone method like we do with disk? I guess my point is I'd prefer to be explicit about the transformation that we're doing to the data we're getting back. |
@icco ok, I guess we can go with it :) |
@icco I want to follow least astonishment principle in the question with urls and names. Personally I was surprised with fact that |
@icco if you agree with this approach, I'll move other requests to use this convention. |
Sounds good to me. Thanks! |
… after they exited with exceptions
I close this PR as far I as merged this branch to #2501. |
Thanks! On Wed, Jan 15, 2014 at 5:33 AM, Alexander Lomov
|
Google Engine live tests fail after v1 update. More fixes coming.