Merge "Add test_create_server_on_network_without_subnet"

This commit is contained in:
Jenkins 2017-02-22 12:23:12 +00:00 committed by Gerrit Code Review
commit 1046c55723
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'))