From 1bbecbd98f368c8891d291e187481b5d1c2374d9 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Wed, 1 Feb 2017 18:20:16 -0500 Subject: [PATCH] Fix the terminated_at field in the server query params schema The field is 'terminated_at', not 'terminate_at', which was probably just a typo. This fixes the field name in the server query parameter schema and adds a test to show it working. Change-Id: I279fa7b40da1d1057a9774e2dc380425454f11dd Closes-Bug: #1661113 --- nova/api/openstack/compute/schemas/servers.py | 2 +- nova/tests/unit/api/openstack/compute/test_serversV21.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nova/api/openstack/compute/schemas/servers.py b/nova/api/openstack/compute/schemas/servers.py index 91c5b093face..513d16995c60 100644 --- a/nova/api/openstack/compute/schemas/servers.py +++ b/nova/api/openstack/compute/schemas/servers.py @@ -300,7 +300,7 @@ query_params_v21 = { 'flavor': common_regex_param, 'reservation_id': common_regex_param, 'launched_at': common_regex_param, - 'terminate_at': common_regex_param, + 'terminated_at': common_regex_param, 'availability_zone': common_regex_param, # NOTE(alex_xu): This is pattern matching, it didn't get any benefit # from DB index. diff --git a/nova/tests/unit/api/openstack/compute/test_serversV21.py b/nova/tests/unit/api/openstack/compute/test_serversV21.py index 3afc73bb842f..7287bbfeeec1 100644 --- a/nova/tests/unit/api/openstack/compute/test_serversV21.py +++ b/nova/tests/unit/api/openstack/compute/test_serversV21.py @@ -1182,6 +1182,7 @@ class ServersControllerTest(ControllerTest): self.assertIsNotNone(search_opts) # Allowed by user self.assertIn('name', search_opts) + self.assertIn('terminated_at', search_opts) # OSAPI converts status to vm_state self.assertIn('vm_state', search_opts) # Allowed only by admins with admin API on @@ -1192,7 +1193,8 @@ class ServersControllerTest(ControllerTest): self.stubs.Set(compute_api.API, 'get_all', fake_get_all) - query_str = "name=foo&ip=10.*&status=active&unknown_option=meow" + query_str = ("name=foo&ip=10.*&status=active&unknown_option=meow&" + "terminated_at=^2016-02-01.*") req = self.req('/fake/servers?%s' % query_str, use_admin_context=True) servers = self.controller.index(req)['servers']