From e453fe5ccafa123eaeb73b55588f073717dec639 Mon Sep 17 00:00:00 2001 From: ghanshyam Date: Fri, 18 Sep 2015 10:21:28 +0900 Subject: [PATCH] Add missing schema for update agent API There is missing response schema for update Agent API. This commit adds the same and also correcting the unit test for update agent. Change-Id: I68a5f038d58c1fd1026475516c34aa5d0d82b74f --- .../response/compute/v2_1/agents.py | 22 +++++++++++++++++++ tempest_lib/services/compute/agents_client.py | 1 + .../services/compute/test_agents_client.py | 3 --- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tempest_lib/api_schema/response/compute/v2_1/agents.py b/tempest_lib/api_schema/response/compute/v2_1/agents.py index da38198..6f712b4 100644 --- a/tempest_lib/api_schema/response/compute/v2_1/agents.py +++ b/tempest_lib/api_schema/response/compute/v2_1/agents.py @@ -55,6 +55,28 @@ create_agent = { } } +update_agent = { + 'status_code': [200], + 'response_body': { + 'type': 'object', + 'properties': { + 'agent': { + 'type': 'object', + 'properties': { + 'agent_id': {'type': ['integer', 'string']}, + 'version': {'type': 'string'}, + 'url': {'type': 'string', 'format': 'uri'}, + 'md5hash': {'type': 'string'} + }, + 'additionalProperties': False, + 'required': ['agent_id', 'version', 'url', 'md5hash'] + } + }, + 'additionalProperties': False, + 'required': ['agent'] + } +} + delete_agent = { 'status_code': [200] } diff --git a/tempest_lib/services/compute/agents_client.py b/tempest_lib/services/compute/agents_client.py index fbf8cd1..8d4b2eb 100644 --- a/tempest_lib/services/compute/agents_client.py +++ b/tempest_lib/services/compute/agents_client.py @@ -51,4 +51,5 @@ class AgentsClient(rest_client.RestClient): put_body = json.dumps({'para': kwargs}) resp, body = self.put('os-agents/%s' % agent_id, put_body) body = json.loads(body) + self.validate_response(schema.update_agent, resp, body) return rest_client.ResponseBody(resp, body) diff --git a/tempest_lib/tests/services/compute/test_agents_client.py b/tempest_lib/tests/services/compute/test_agents_client.py index cb8b7cb..5a480c4 100644 --- a/tempest_lib/tests/services/compute/test_agents_client.py +++ b/tempest_lib/tests/services/compute/test_agents_client.py @@ -33,11 +33,8 @@ class TestAgentsClient(base.BaseComputeServiceTest): FAKE_UPDATE_AGENT = { "agent": { "url": "http://foo.com", - "hypervisor": "kvm", "md5hash": "md5", "version": "2", - "architecture": "x86_64", - "os": "linux", "agent_id": 1 } }