From ce4d50b877b3095629770a8dbb9a32e31a69cf06 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Wed, 10 Aug 2016 19:05:54 -0700 Subject: [PATCH] Add floating IP test to ensure backwards compat This adds an API test to ensure that we maintain the behavior of disassociating a floating IP if it receives an update with an empty body. Change-Id: I9efd941b621e15691af95cd88f391aa564e4b9bd Related-Bug: #1607746 --- neutron/tests/tempest/api/test_floating_ips.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/neutron/tests/tempest/api/test_floating_ips.py b/neutron/tests/tempest/api/test_floating_ips.py index 570ca54ef73..8ccdd44c8c2 100644 --- a/neutron/tests/tempest/api/test_floating_ips.py +++ b/neutron/tests/tempest/api/test_floating_ips.py @@ -41,6 +41,20 @@ class FloatingIPTestJSON(base.BaseNetworkTest): for i in range(2): cls.create_port(cls.network) + @test.idempotent_id('f6a0fb6c-cb64-4b81-b0d5-f41d8f69d22d') + def test_blank_update_clears_association(self): + # originally the floating IP had no attributes other than its + # association, so an update with an empty body was a signal to + # clear the association. This test ensures we maintain that behavior. + body = self.client.create_floatingip( + floating_network_id=self.ext_net_id, + port_id=self.ports[0]['id'], + description='d1' + )['floatingip'] + self.assertEqual(self.ports[0]['id'], body['port_id']) + body = self.client.update_floatingip(body['id'])['floatingip'] + self.assertFalse(body['port_id']) + @test.idempotent_id('c72c1c0c-2193-4aca-eeee-b1442641ffff') @test.requires_ext(extension="standard-attr-description", service="network")