Public bug reported: 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 ** Affects: glance Importance: Low Status: Triaged -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to Glance. https://bugs.launchpad.net/bugs/1645392 Title: refactor functional tests for IPv6 Status in Glance: Triaged 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 manage notifications about this bug go to: https://bugs.launchpad.net/glance/+bug/1645392/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

