Ignore created_at/updated_at in test_show_port
test_show_port compares dict elements from create_port & show_port.
The POST request in create_resource may retrieve inconsistent time
for created_at/updated_at elements when the actual resource creation
turns the next second to fill database. This patch ignores these two
fields when comparing port dicts from create/show functions.
With this patch test_show_port avoids mismatch errors like this:
created_at: expected 2016-03-23T22:20:42, actual 2016-03-23T22:20:41
updated_at: expected 2016-03-23T22:20:42, actual 2016-03-23T22:20:41
Change-Id: Ic6a17c88cbc394eb970cfcc994de53288305f612
Closes-Bug: #1563885
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 5ff23c6..e302284 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -131,12 +131,15 @@
body = self.ports_client.show_port(self.port['id'])
port = body['port']
self.assertIn('id', port)
- # TODO(Santosh)- This is a temporary workaround to compare create_port
- # and show_port dict elements.Remove this once extra_dhcp_opts issue
- # gets fixed in neutron.( bug - 1365341.)
+ # NOTE(rfolco): created_at and updated_at may get inconsistent values
+ # due to possible delay between POST request and resource creation.
+ # TODO(rfolco): Neutron Bug #1365341 is fixed, can remove the key
+ # extra_dhcp_opts in the O release (K/L gate jobs still need it).
self.assertThat(self.port,
custom_matchers.MatchesDictExceptForKeys
- (port, excluded_keys=['extra_dhcp_opts']))
+ (port, excluded_keys=['extra_dhcp_opts',
+ 'created_at',
+ 'updated_at']))
@test.idempotent_id('45fcdaf2-dab0-4c13-ac6c-fcddfb579dbd')
def test_show_port_fields(self):