Fixes failing API Tests
Speed up failure state detection Fixed test_list_services_multiple_page Fixed invalid exception thrown Ignore flavor creation tests when config setting is set to False Added negative test for origin with duplicate rules Removed falcon validators Refactored Service and Flavor Schema Validation functions Fixed issue with duplicate request_url rules for origin, caching Change-Id: I83ee6f88e37c1b9033df20ed46dcc7f650d71202 Closes-Bug: 1394720
This commit is contained in:
@@ -24,14 +24,13 @@ except ImportError:
|
||||
use_uwsgi = False
|
||||
|
||||
import jsonpatch
|
||||
import jsonschema
|
||||
|
||||
from poppy.common import errors
|
||||
from poppy.manager import base
|
||||
from poppy.model import service
|
||||
from poppy.openstack.common import log
|
||||
from poppy.transport.validators import helpers as validators
|
||||
from poppy.transport.validators.schemas import service as service_schema
|
||||
from poppy.transport.validators.stoplight import exceptions
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
@@ -81,7 +80,7 @@ class DefaultServicesController(base.ServicesController):
|
||||
|
||||
:param project_id
|
||||
:param service_obj
|
||||
:raises LoookupError, ValueError
|
||||
:raises LookupError, ValueError
|
||||
"""
|
||||
try:
|
||||
flavor = self.flavor_controller.get(service_obj.flavor_id)
|
||||
@@ -127,6 +126,7 @@ class DefaultServicesController(base.ServicesController):
|
||||
:param project_id
|
||||
:param service_id
|
||||
:param service_updates
|
||||
:raises LookupError, ValueError
|
||||
"""
|
||||
# get the current service object
|
||||
try:
|
||||
@@ -140,7 +140,7 @@ class DefaultServicesController(base.ServicesController):
|
||||
|
||||
service_old_json = json.loads(json.dumps(service_old.to_dict()))
|
||||
|
||||
# remove fileds that cannot be part of PATCH
|
||||
# remove fields that cannot be part of PATCH
|
||||
del service_old_json['service_id']
|
||||
del service_old_json['status']
|
||||
del service_old_json['provider_details']
|
||||
@@ -149,21 +149,16 @@ class DefaultServicesController(base.ServicesController):
|
||||
service_old_json, service_updates)
|
||||
|
||||
# validate the updates
|
||||
patch_schema = service_schema.ServiceSchema.get_schema("service",
|
||||
"POST")
|
||||
errors_list = list(
|
||||
jsonschema.Draft3Validator(patch_schema).iter_errors(
|
||||
service_new_json))
|
||||
schema = service_schema.ServiceSchema.get_schema("service", "POST")
|
||||
validators.is_valid_service_configuration(service_new_json, schema)
|
||||
|
||||
if len(errors_list) > 0:
|
||||
details = dict(errors=[{
|
||||
'message': '-'.join([
|
||||
"[%s]" % "][".join(repr(p) for p in error.path),
|
||||
str(getattr(error, "message", error))
|
||||
])}
|
||||
for error in errors_list])
|
||||
raise exceptions.ValidationFailed(json.dumps(details))
|
||||
try:
|
||||
self.flavor_controller.get(service_new_json['flavor_id'])
|
||||
# raise a lookup error if the flavor is not found
|
||||
except LookupError as e:
|
||||
raise e
|
||||
|
||||
# must be valid, carry on
|
||||
service_new_json['service_id'] = service_old.service_id
|
||||
service_new = service.Service.init_from_dict(service_new_json)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user