test-kitchen / vmware-vra-gem

A Ruby Gem for interacting with the VMware vRealize Automation system
Apache License 2.0
15 stars 32 forks source link

Vra::Resource#ip_addresses non-deterministically returns an empty array in error #65

Closed lgustafson closed 6 years ago

lgustafson commented 6 years ago

Versions:

Platform Details

Scenario:

When used with Test Kitchen and the kitchen-vra driver, I see non-deterministic failures to collect IP addresses from provisioned machines. This results in frequent test failures. However, when inspecting the provisioned machine from the vRA GUI, an IP address is present for said machine.

Steps to Reproduce:

Note that the error is non-deterministic, because it appears to be based on the position of a resource in the content array when calling endpoint "/catalog-service/api/consumer/requests/#{request_id}/resourceViews" from Vra::Resource#ip_addresses.

One way to reproduce it intermittently is to use a vRA blueprint which has an explicit network profile element attached to a VM. In this case, the virtual machine object is in a later position in the content array and one that Vra::Resource#ip_addresses is not inspecting. Thus, is appears that the virtual machine has no IP address when in fact it does.

Expected Result:

I expect Vra::Resource#ip_addresses to return a non-empty array of IP addresses.

Actual Result:

When this issue is encountered in the context of the kitchen-vra driver, the machine is destroyed before convergence because an empty array is returned from Vra::Resource#ip_addresses.

Here is an exmaple error message

Waiting For vRA to collect the IP$$$$$$ Server cc2dd1e5-5d9b-4ef7-8b99-c4594f683e5c has no IP address. Falling back to server name (kitchen-vra-001522)...
       Server cc2dd1e5-5d9b-4ef7-8b99-c4594f683e5c (kitchen-vra-001522) created. Waiting until ready...
$$$$$$ Server cc2dd1e5-5d9b-4ef7-8b99-c4594f683e5c (kitchen-vra-001522) not reachable: SocketError -- getaddrinfo: Name or service not known
$$$$$$ Sleeping 5 seconds and retrying...
$$$$$$ Server cc2dd1e5-5d9b-4ef7-8b99-c4594f683e5c (kitchen-vra-001522) not reachable: SocketError -- getaddrinfo: Name or service not known
>>>>>> Retries exceeded. Destroying server...
lgustafson commented 6 years ago

I have a PR for this with test cases I will be submitting.

jjasghar commented 6 years ago

Closed per #66