diff options
| author | zhangbailin <zhangbailin@inspur.com> | 2019-05-06 19:06:55 +0800 |
|---|---|---|
| committer | Brin Zhang <zhangbailin@inspur.com> | 2019-05-31 05:39:29 +0000 |
| commit | ef1fd388154eee11b9e83f80e5004670fdffb6cc (patch) | |
| tree | 560f2f6d83619a45f18070966ad338b9555396a0 /openstackclient/tests/functional/compute | |
| parent | 91bc0f35def33d49d293be4bd517678222c6b791 (diff) | |
| download | python-openstackclient-ef1fd388154eee11b9e83f80e5004670fdffb6cc.tar.gz | |
Add changes-before attribute to server list
Closes-Bug: #1827844
Part of bp support-to-query-nova-resources-filter-by-changes-before
Change-Id: I4f28168188973730247bcbcb70ba0e70eb81e3be
Diffstat (limited to 'openstackclient/tests/functional/compute')
| -rw-r--r-- | openstackclient/tests/functional/compute/v2/test_server.py | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/openstackclient/tests/functional/compute/v2/test_server.py b/openstackclient/tests/functional/compute/v2/test_server.py index c8fb44d3..6330ac98 100644 --- a/openstackclient/tests/functional/compute/v2/test_server.py +++ b/openstackclient/tests/functional/compute/v2/test_server.py @@ -63,6 +63,84 @@ class ServerTests(common.ComputeTestCase): self.assertNotIn(name1, col_name) self.assertIn(name2, col_name) + def test_server_list_with_changes_before(self): + """Test server list. + + Getting the servers list with updated_at time equal or + before than changes-before. + """ + cmd_output = self.server_create() + server_name1 = cmd_output['name'] + + cmd_output = self.server_create() + server_name2 = cmd_output['name'] + updated_at2 = cmd_output['updated'] + + cmd_output = self.server_create() + server_name3 = cmd_output['name'] + + cmd_output = json.loads(self.openstack( + '--os-compute-api-version 2.66 ' + + 'server list -f json ' + '--changes-before ' + updated_at2 + )) + + col_updated = [server["Name"] for server in cmd_output] + self.assertIn(server_name1, col_updated) + self.assertIn(server_name2, col_updated) + self.assertNotIn(server_name3, col_updated) + + def test_server_list_with_changes_since(self): + """Test server list. + + Getting the servers list with updated_at time equal or + later than changes-since. + """ + cmd_output = self.server_create() + server_name1 = cmd_output['name'] + cmd_output = self.server_create() + server_name2 = cmd_output['name'] + updated_at2 = cmd_output['updated'] + cmd_output = self.server_create() + server_name3 = cmd_output['name'] + + cmd_output = json.loads(self.openstack( + 'server list -f json ' + '--changes-since ' + updated_at2 + )) + + col_updated = [server["Name"] for server in cmd_output] + self.assertNotIn(server_name1, col_updated) + self.assertIn(server_name2, col_updated) + self.assertIn(server_name3, col_updated) + + def test_server_list_with_changes_before_and_changes_since(self): + """Test server list. + + Getting the servers list with updated_at time equal or before than + changes-before and equal or later than changes-since. + """ + cmd_output = self.server_create() + server_name1 = cmd_output['name'] + cmd_output = self.server_create() + server_name2 = cmd_output['name'] + updated_at2 = cmd_output['updated'] + cmd_output = self.server_create() + server_name3 = cmd_output['name'] + updated_at3 = cmd_output['updated'] + + cmd_output = json.loads(self.openstack( + '--os-compute-api-version 2.66 ' + + 'server list -f json ' + + '--changes-since ' + updated_at2 + + ' --changes-before ' + updated_at3 + )) + + col_updated = [server["Name"] for server in cmd_output] + self.assertNotIn(server_name1, col_updated) + self.assertIn(server_name2, col_updated) + self.assertIn(server_name3, col_updated) + def test_server_set(self): """Test server create, delete, set, show""" cmd_output = self.server_create() |
