-
Notifications
You must be signed in to change notification settings - Fork 66
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
Add spec test for a full refresh #138
Conversation
@miq-bot add_label wip |
end | ||
|
||
def assert_guest_table_contents | ||
nic = GuestDevice.where(:device_name => "Broadcom 2-port 1GbE NIC Card for IBM").first |
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.
Probably better going through a physical_server association since that name doesn't look like it'd be particularly unique
nic = GuestDevice.where(:device_name => "Broadcom 2-port 1GbE NIC Card for IBM").first | ||
ports = nic.child_devices | ||
|
||
expect(ports[0].device_name).to eq("Physical Port 1") |
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.
Not a good idea to dereference the array without sorting it first since the return order isn't guaranteed and can lead to sporadic test failures
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.
Better to say something like
port_1 = ports.find_by(:device_name => "Physical Port 1")
@skovic commented, looks like the VCRs might have to be re-recorded? There are vcr errors in the spec tests |
@agrare It works running it locally (with the same vcr files). I'm not sure what to make of this error. This is why it's failing:
Notice the strange format of the IP address. Any idea about why this may be occurring? |
@skovic |
so @skovic when you said you reproduced this with only one refresh, what exactly was it that you saw? I thought the issue was that ports were getting switched between two refreshes but maybe I don't understand what the bug is exactly. |
@agrare For example, before a refresh, a NIC may have two ports with the following names and MAC addresses:
After a refresh, the NIC now has the following two ports:
It's as if Port 2 disappeared and was replaced by a duplicate of Port 1. |
@agrare Looks like the same issue again with the malformed IP address. Any idea how I can debug this possible init_parser problem? Thanks |
@skovic I would step into what that |
@agrare @rodneyhbrown7 Regarding the bug itself. I believe that I've figured out more precisely the conditions under which the bug occurs and what might be occurring. Here are the preconditions:
Here is how to reproduce the problem:
When the second provider, provider2, is added, a second entry for server1 is created in the physical_servers table in the database. Likewise, a second entry is created for server1's NIC in the guest_devices table. When the second provider, provider2, is refreshed, the entries for the NIC in the guest_devices table somehow become mangled. |
I have a theory about the spec test failure. This is the only spec test where we call EmsRefresh. I think EmsRefresh is attempting to create an actual ems instance instead of using the factory instance. We have code in our provider that attempts to resolve any hostname given. This way we can convert IP addresses to hostnames. Line 96 in e615a3e
In this case I think we are asking DNS to resolve the provided host name. This is going out to Amazon's hosted DNS service and returning a private host name for the given address of the form xx-xx-xx-xx.ec.internal. When we run internally, this IP actually resolves to a valid address so we don't run into this block. See reference: https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-dns.html @skovic Maybe you can disable the resolver temporarily and see if that enables the test to pass? |
@rodneyhbrown7 Thanks. Temporarily disabling resolving of hostnames let the test pass. |
@skovic what if you set the ipaddress in the FactoryGirl ems? Looks like that will shortcut the resolve code |
@agrare I thought we were already doing that:
|
So it will only try to resolve if one of these is true, probably if you switched the full URL to the hostname or made up a dummy hostname it won't call to resolve
|
7b10e1c
to
b6997d2
Compare
Checked commits skovic/manageiq-providers-lenovo@1d00d59~...b6997d2 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 **
|
@agrare Looks like a dummy hostname has fixed the problem. Please let me know if you would like me to make any other changes. Thanks |
@miq-bot remove_label wip |
This PR adds a test case for testing a full refresh. In particular, it attempts to recreate the guest_devices table problem described in Bug 1542710.