8ee3e30bd1
The aggregate.create.start and aggregate.create.end notifications has been transformed to the versioned notification framework. The notification payload contains the 'id' of the aggregate which is the db primary key. It is added because the REST API also uses the db id instead of the uuid in the os-aggregates' requests and responses. Implements: bp versioned-notification-transformation-ocata Change-Id: I92fe504a8f7dc19b0e1df5884045d4bc0d9e4f98
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
from nova.tests.functional.api import client as api_client
|
|
from nova.tests.functional.notification_sample_tests \
|
|
import notification_sample_base
|
|
from nova.tests.unit import fake_notifier
|
|
|
|
|
|
class TestExceptionNotificationSample(
|
|
notification_sample_base.NotificationSampleTestBase):
|
|
|
|
def test_versioned_exception_notification_with_correct_params(
|
|
self):
|
|
|
|
post = {
|
|
"aggregate": {
|
|
"name": "versioned_exc_aggregate",
|
|
"availability_zone": "nova"
|
|
}
|
|
}
|
|
|
|
self.admin_api.api_post('os-aggregates', post)
|
|
# recreating the aggregate raises exception
|
|
self.assertRaises(api_client.OpenStackApiException,
|
|
self.admin_api.api_post, 'os-aggregates', post)
|
|
|
|
self.assertEqual(4, len(fake_notifier.VERSIONED_NOTIFICATIONS))
|
|
self._verify_notification(
|
|
'compute-exception',
|
|
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
|