From c3577e90b3a94a71ab35dde7788194c67a9cf8db Mon Sep 17 00:00:00 2001 From: Georgy Dyuldin Date: Wed, 8 Feb 2017 14:37:47 +0300 Subject: [PATCH] Add test_create_server_on_network_without_subnet Change-Id: Ic99c8dfe5fb5b7d5a5b1035d33a969b99f1eb92d --- .../vapor/vapor/tests/common/test_base.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugin_test/vapor/vapor/tests/common/test_base.py b/plugin_test/vapor/vapor/tests/common/test_base.py index 60257531d..e725f6383 100644 --- a/plugin_test/vapor/vapor/tests/common/test_base.py +++ b/plugin_test/vapor/vapor/tests/common/test_base.py @@ -15,6 +15,7 @@ import sys from hamcrest import (assert_that, calling, raises, contains_string, has_item, has_entry, is_not, empty, equal_to, all_of) # noqa H301 from neutronclient.common import exceptions as neutron_exceptions +from novaclient import exceptions as nova_exceptions from stepler import config as stepler_config from stepler.third_party import utils from pycontrail import exceptions @@ -361,3 +362,20 @@ def test_various_type_of_subnets_associated_with_vn( result = server_ssh.check_call('ip a') assert_that(result.stdout, all_of(*[contains_string(name) for name in iface_names])) + + +def test_create_server_on_network_without_subnet( + cirros_image, + flavor, + contrail_network, + server_steps, ): + """Creating server on network without subnet should raise an exception.""" + assert_that( + calling(server_steps.create_servers).with_args( + image=cirros_image, + flavor=flavor, + networks=[{ + 'id': contrail_network.uuid + }], + check=False), + raises(nova_exceptions.BadRequest, 'requires a subnet'))