diff options
author | Ruby Loo <ruby.loo@intel.com> | 2017-09-21 10:11:53 -0400 |
---|---|---|
committer | Ruby Loo <ruby.loo@intel.com> | 2017-09-28 21:02:12 +0000 |
commit | 12399ffc797e6b69f5ca2ba15134a09dff025318 (patch) | |
tree | e9a56ff4c30ab3941e0aae88a10e06bb7c71832e /ironic/tests/unit/api | |
parent | f8a42d366c0d20918fee579406feffe83c1f7b9a (diff) | |
download | ironic-12399ffc797e6b69f5ca2ba15134a09dff025318.tar.gz |
Remove 'next' for GET /nodes?limit=1&instance_uuid=
For a "GET /nodes?limit=1&instance_uuid=<uuid>" request that has a
node that matches, the response would include a 'next' link.
(Note that the generated 'next' link happens to be incorrect; it
doesn't include 'instance_uuid'). However, at most one node can match
the specified instance UUID, so we should not be returning any 'next'
link.
This fixes it so no 'next' link is returned.
Change-Id: I4efe06652baf3423790c238d4a8d2bc5a736b3a5
Closes-Bug: #1718683
Diffstat (limited to 'ironic/tests/unit/api')
-rw-r--r-- | ironic/tests/unit/api/controllers/v1/test_node.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ironic/tests/unit/api/controllers/v1/test_node.py b/ironic/tests/unit/api/controllers/v1/test_node.py index 84d6c1c4f..3346b0431 100644 --- a/ironic/tests/unit/api/controllers/v1/test_node.py +++ b/ironic/tests/unit/api/controllers/v1/test_node.py @@ -533,6 +533,22 @@ class TestListNodes(test_api_base.BaseApiTest): next_marker = data['nodes'][-1]['uuid'] self.assertIn(next_marker, data['next']) + def test_collection_links_instance_uuid_param(self): + cfg.CONF.set_override('max_limit', 1, 'api') + nodes = [] + for id in range(2): + node = obj_utils.create_test_node( + self.context, + uuid=uuidutils.generate_uuid(), + instance_uuid=uuidutils.generate_uuid(), + resource_class='tst_resource') + nodes.append(node) + + query_str = 'instance_uuid=%s' % nodes[0].instance_uuid + data = self.get_json('/nodes?%s' % query_str) + self.assertEqual(1, len(data['nodes'])) + self.assertNotIn('next', data) + def test_sort_key(self): nodes = [] for id in range(3): |