refactor functional tests for IPv6

Bug #1645392 reported by Brian Rosmaita
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Triaged
Low
Unassigned

Bug Description

A recent change to correct an IPv6 problem [0] monkeypatches FunctionalTest. An alternative would be to do what Stuart suggested on that patch [1], namely:

If we wanted to get fancy/avoid this monkey patching, we could potentially define an IPV6FunctionalTest which would be a subclass of FunctionalTest. We could define a get_unused_port method which could be ipv6 in the case of IPV6FunctionalTest and ipv4 in the regular FunctionalTest.

Another alternative was suggested by Tomislav on that same patch:

It also crossed my mind that I can introduce a new optional parameter in functions get_unused_port and get_unused_port_and_socket in glance/tests/utils.py, e.g. ip_version which would default to 4. And in addition, FunctionalTest class could have additional member (variable) of similar name meaning which would have to be set properly (overridden) before calling setUp. This would definitely improve chances to switch from IPv4 to IPv6 for the whole testing suite with simple change of default value once IPv6 becomes used more often.

(Tomislav was worried that creating a subclass would involve duplicating some methods, which would mean more code to maintain.)

It would be good to look into this and decide which way of refactoring is best, and put it on the agenda for the glance weekly meeting to get some feedback before/during coding.

[0] https://review.openstack.org/394946
[1] https://review.openstack.org/#/c/394946/4/glance/tests/functional/v2/test_images.py@2921

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.