Add test_create_server_on_network_without_subnet

Change-Id: Ic99c8dfe5fb5b7d5a5b1035d33a969b99f1eb92d
This commit is contained in:
Georgy Dyuldin 2017-02-08 14:37:47 +03:00
parent e9bb388d2b
commit c3577e90b3
1 changed files with 18 additions and 0 deletions

View File

@ -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'))