Comment 4 for bug 1301046

Revision history for this message
Mario Villaplana (mario-villaplana-j) wrote :

I'm looking at one test case in-depth to see how the tests rely on this. Multiple test cases are failing with the same error message when I change Port._set_node_uuid to only allow the passed value to be a node UUID (changing objects.Node.get to objects.Node.get_by_uuid within the function).

The test case I'm examining is test_get_one in tests/api/v1/test_ports.

The part of the test that's failing with this change is the GET request to retrieve the port. It looks like the port retrieved via RPC in get_one in the ports API controller doesn't have a _node_uuid attached but does have a node ID attached.

Like your stack trace shows, having the node ID in the RPC (or anything that passes a node id to the Port constructor in the ports API controller) causes a NodeNotFound error. convert_with_links creates a new Port from the RPC port with the node ID still attached, causing the error.

I think the best next step is to examine what the RPC call to retrieve a port returns in a successful invocation of get_one with the small change described above. This will show us what the RPC port *should* look like and isolate what the tests are doing differently that causes them to fail. If there are no possible successful invocations of get_one with the change described above, I might have to reconsider some assumptions about what _set_node_uuid expects and guarantees.