diff options
| author | Russell Bryant <rbryant@redhat.com> | 2013-03-04 20:35:27 -0500 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2013-03-04 20:45:42 -0500 |
| commit | 5d83d23cb7f7e95fedbd339405d93bc3841049ea (patch) | |
| tree | c22411e3587cf3f3ada2154f6d12ac6bf75c950c /nova/tests | |
| parent | a246cb90d229aea5cf70d886ad76061d5ad59010 (diff) | |
Bump instance updated_at on network change.
Update add-fixed-ip and remove-fixed-ip code paths to update the
updated_at field of the instance, since from the user's perspective
through the API, they have made a change to the instance's
configuration. In that case, it makes sense to expect that the
updated_at field gets changed.
Fix bug 1143466.
Change-Id: Icfd7d0b1b556795d94a22c1719727f8c9fc744f0
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/compute/test_compute.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 7869b76cc..e5a5c8b4b 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -3756,6 +3756,30 @@ class ComputeTestCase(BaseTestCase): self.mox.ReplayAll() self.compute._instance_usage_audit(self.context) + def test_add_remove_fixed_ip_updates_instance_updated_at(self): + def _noop(*args, **kwargs): + pass + + self.stubs.Set(self.compute.network_api, + 'add_fixed_ip_to_instance', _noop) + self.stubs.Set(self.compute.network_api, + 'remove_fixed_ip_from_instance', _noop) + + instance = self._create_fake_instance() + updated_at_1 = instance['updated_at'] + + self.compute.add_fixed_ip_to_instance(self.context, 'fake', instance) + instance = db.instance_get_by_uuid(self.context, instance['uuid']) + updated_at_2 = instance['updated_at'] + + self.compute.remove_fixed_ip_from_instance(self.context, 'fake', + instance) + instance = db.instance_get_by_uuid(self.context, instance['uuid']) + updated_at_3 = instance['updated_at'] + + updated_ats = (updated_at_1, updated_at_2, updated_at_3) + self.assertEqual(len(updated_ats), len(set(updated_ats))) + class ComputeAPITestCase(BaseTestCase): |
