Remove old test cases based on stack manager classs.

These test cases are being replaced by the new test_floating_ip
neutron test case based on HeatStackFixture class.

Change-Id: I6a981ad23b70ef888bd85cc1d83e7f2c6d6a6198
This commit is contained in:
Federico Ressi 2019-04-02 13:38:11 +02:00
parent dc0ef0e16f
commit 3af05eec8a
11 changed files with 0 additions and 844 deletions

View File

@ -14,8 +14,6 @@
# under the License.
from __future__ import absolute_import
import os.path
from tobiko.cmd import base
from tobiko.tests.openstack import base as test_base
@ -28,7 +26,6 @@ class TobikoCMDTest(test_base.OpenstackTest):
def test_init(self, argv=None):
self.patch_argv(argv=argv)
cmd = self.command_class()
self.assertTrue(os.path.isdir(cmd.templates_dir))
self.assertIsNotNone(cmd.stackManager)
return cmd

View File

@ -1,59 +0,0 @@
# Copyright (c) 2018 Red Hat
# All Rights Reserved.
#
# 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 __future__ import absolute_import
import os
from tobiko.tests import base
from tobiko.common.managers import stack as stack_manager
from tobiko.common.managers import network
from tobiko.common import constants
class ScenarioTestsBase(base.TobikoTest):
"""All scenario tests inherit from this scenario base class."""
default_params = constants.DEFAULT_PARAMS
networks = network.NetworkManager()
templates_dir = os.path.join(os.path.dirname(__file__), 'templates')
stacks = stack_manager.StackManager(templates_dir=templates_dir)
stack = None
fault = None
@classmethod
def setUpClass(cls):
super(ScenarioTestsBase, cls).setUpClass()
cls.stack_name = cls.__module__.rsplit('.', 1)[-1]
cls.setup_stack()
@classmethod
def setup_stack(cls):
if not cls.stack:
cls.stack = (
cls.stacks.wait_for_stack_status(
stack_name=cls.stack_name,
check=False) or
cls.create_stack())
return cls.stack
@classmethod
def create_stack(cls, stack_name=None, template_name=None, **parameters):
"""Creates stack to be used by all scenario tests."""
stack_name = stack_name or cls.stack_name
template_name = template_name or stack_name + ".yaml"
parameters = dict(cls.default_params, **parameters)
return cls.stacks.create_stack(
stack_name=stack_name, template_name=template_name,
parameters=parameters)

View File

@ -1,116 +0,0 @@
heat_template_version: 2013-05-23
description: |
Default stack used by tests. One instance with FIP.
parameters:
flavor:
type: string
image:
type: string
subnet_cidr:
type: string
default: 190.40.2.0/24
public_net:
type: string
default: public
private_net:
type: string
default: heat-net
dns_servers:
type: comma_delimited_list
default: ["8.8.8.8", "8.8.4.4"]
resources:
sg:
type: OS::Neutron::SecurityGroup
properties:
name: sg
description: Security group to allow ICMP and SSH
rules:
- protocol: icmp
- protocol: tcp
port_range_min: 22
port_range_max: 22
sg2:
type: OS::Neutron::SecurityGroup
properties:
name: sg2
description: Security group to deny ICMP and SSH
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_net}
floating_ip2:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_net}
network:
type: OS::Neutron::Net
subnet:
type: OS::Neutron::Subnet
properties:
network: {get_resource: network}
ip_version: 4
cidr: {get_param: subnet_cidr}
dns_nameservers: {get_param: dns_servers}
router:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: {get_param: public_net}
router_interface:
type: OS::Neutron::RouterInterface
properties:
router: {get_resource: router}
subnet: {get_resource: subnet}
wait_handle:
type: OS::Heat::WaitConditionHandle
server:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: flavor}
networks:
- subnet: {get_resource: subnet}
security_groups:
- {get_resource: sg}
# Server without security groups
server2:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: flavor}
networks:
- subnet: {get_resource: subnet}
security_groups:
- {get_resource: sg2}
server_floating_ip_assoc:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip}
port_id: {get_attr: [server, addresses, {get_resource: network}, 0, port]}
server_floating_ip_assoc2:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip2}
port_id: {get_attr: [server2, addresses, {get_resource: network}, 0, port]}
outputs:
server_ip:
value: {get_attr: [floating_ip, floating_ip_address]}
server_ip2:
value: {get_attr: [floating_ip2, floating_ip_address]}

View File

@ -1,116 +0,0 @@
heat_template_version: 2013-05-23
description: |
Default stack used by tests. One instance with FIP.
parameters:
flavor:
type: string
image:
type: string
subnet_cidr:
type: string
default: 190.40.2.0/24
public_net:
type: string
default: public
private_net:
type: string
default: heat-net
dns_servers:
type: comma_delimited_list
default: ["8.8.8.8", "8.8.4.4"]
resources:
sg:
type: OS::Neutron::SecurityGroup
properties:
name: sg
description: Security group to allow ICMP and SSH
rules:
- protocol: icmp
- protocol: tcp
port_range_min: 22
port_range_max: 22
sg2:
type: OS::Neutron::SecurityGroup
properties:
name: sg2
description: Security group to deny ICMP and SSH
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_net}
floating_ip2:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_net}
network:
type: OS::Neutron::Net
subnet:
type: OS::Neutron::Subnet
properties:
network: {get_resource: network}
ip_version: 4
cidr: {get_param: subnet_cidr}
dns_nameservers: {get_param: dns_servers}
router:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: {get_param: public_net}
router_interface:
type: OS::Neutron::RouterInterface
properties:
router: {get_resource: router}
subnet: {get_resource: subnet}
wait_handle:
type: OS::Heat::WaitConditionHandle
server:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: flavor}
networks:
- subnet: {get_resource: subnet}
security_groups:
- {get_resource: sg}
# Server without security groups
server2:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: flavor}
networks:
- subnet: {get_resource: subnet}
security_groups:
- {get_resource: sg2}
server_floating_ip_assoc:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip}
port_id: {get_attr: [server, addresses, {get_resource: network}, 0, port]}
server_floating_ip_assoc2:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip2}
port_id: {get_attr: [server2, addresses, {get_resource: network}, 0, port]}
outputs:
fip:
value: {get_attr: [floating_ip, floating_ip_address]}
fip2:
value: {get_attr: [floating_ip2, floating_ip_address]}

View File

@ -1,116 +0,0 @@
heat_template_version: 2013-05-23
description: |
Default stack used by tests. One instance with FIP.
parameters:
flavor:
type: string
image:
type: string
subnet_cidr:
type: string
default: 190.40.2.0/24
public_net:
type: string
default: public
private_net:
type: string
default: heat-net
dns_servers:
type: comma_delimited_list
default: ["8.8.8.8", "8.8.4.4"]
resources:
sg:
type: OS::Neutron::SecurityGroup
properties:
name: sg
description: Security group to allow ICMP and SSH
rules:
- protocol: icmp
- protocol: tcp
port_range_min: 22
port_range_max: 22
sg2:
type: OS::Neutron::SecurityGroup
properties:
name: sg2
description: Security group to deny ICMP and SSH
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_net}
floating_ip2:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_net}
network:
type: OS::Neutron::Net
subnet:
type: OS::Neutron::Subnet
properties:
network: {get_resource: network}
ip_version: 4
cidr: {get_param: subnet_cidr}
dns_nameservers: {get_param: dns_servers}
router:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: {get_param: public_net}
router_interface:
type: OS::Neutron::RouterInterface
properties:
router: {get_resource: router}
subnet: {get_resource: subnet}
wait_handle:
type: OS::Heat::WaitConditionHandle
server:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: flavor}
networks:
- subnet: {get_resource: subnet}
security_groups:
- {get_resource: sg}
# Server without security groups
server2:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: flavor}
networks:
- subnet: {get_resource: subnet}
security_groups:
- {get_resource: sg2}
server_floating_ip_assoc:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip}
port_id: {get_attr: [server, addresses, {get_resource: network}, 0, port]}
server_floating_ip_assoc2:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip2}
port_id: {get_attr: [server2, addresses, {get_resource: network}, 0, port]}
outputs:
fip:
value: {get_attr: [floating_ip, floating_ip_address]}
fip2:
value: {get_attr: [floating_ip2, floating_ip_address]}

View File

@ -1,134 +0,0 @@
heat_template_version: 2013-05-23
description: |
Stack for testing MTU
parameters:
flavor:
type: string
image:
type: string
subnet_cidr:
type: string
default: 190.40.2.0/24
subnet_cidr2:
type: string
default: 190.40.3.0/24
public_net:
type: string
default: public
private_net:
type: string
default: heat-net
dns_servers:
type: comma_delimited_list
default: ["8.8.8.8", "8.8.4.4"]
resources:
sg:
type: OS::Neutron::SecurityGroup
properties:
name: sg
description: Security group to allow ICMP and SSH
rules:
- protocol: icmp
- protocol: tcp
port_range_min: 22
port_range_max: 22
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_net}
floating_ip2:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_net}
network:
type: OS::Neutron::Net
network2:
type: OS::Neutron::Net
subnet:
type: OS::Neutron::Subnet
properties:
network: {get_resource: network}
ip_version: 4
cidr: {get_param: subnet_cidr}
dns_nameservers: {get_param: dns_servers}
subnet2:
type: OS::Neutron::Subnet
properties:
network: {get_resource: network2}
ip_version: 4
cidr: {get_param: subnet_cidr2}
dns_nameservers: {get_param: dns_servers}
router:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: {get_param: public_net}
router_interface:
type: OS::Neutron::RouterInterface
properties:
router: {get_resource: router}
subnet: {get_resource: subnet}
router_interface2:
type: OS::Neutron::RouterInterface
properties:
router: {get_resource: router}
subnet: {get_resource: subnet2}
wait_handle:
type: OS::Heat::WaitConditionHandle
server:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: flavor}
networks:
- subnet: {get_resource: subnet}
security_groups:
- {get_resource: sg}
# Server without security groups
server2:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: flavor}
networks:
- subnet: {get_resource: subnet2}
security_groups:
- {get_resource: sg}
server_floating_ip_assoc:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip}
port_id: {get_attr: [server, addresses, {get_resource: network}, 0, port]}
server_floating_ip_assoc2:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip2}
port_id: {get_attr: [server2, addresses, {get_resource: network2}, 0, port]}
outputs:
fip_max_mtu:
value: {get_attr: [floating_ip, floating_ip_address]}
fip_min_mtu:
value: {get_attr: [floating_ip2, floating_ip_address]}
network_max_mtu:
value: {get_resource: network}
network_min_mtu:
value: {get_resource: network2}

View File

@ -1,118 +0,0 @@
heat_template_version: 2013-05-23
description: |
Stack for testing security groups
parameters:
flavor:
type: string
image:
type: string
subnet_cidr:
type: string
default: 190.40.2.0/24
public_net:
type: string
default: public
private_net:
type: string
default: heat-net
dns_servers:
type: comma_delimited_list
default: ["8.8.8.8", "8.8.4.4"]
resources:
sg:
type: OS::Neutron::SecurityGroup
properties:
name: sg
description: Security group to allow ICMP and SSH
rules:
- protocol: icmp
- protocol: tcp
port_range_min: 22
port_range_max: 22
sg2:
type: OS::Neutron::SecurityGroup
properties:
name: sg2
description: Security group to deny ICMP and SSH
floating_ip:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_net}
floating_ip2:
type: OS::Neutron::FloatingIP
properties:
floating_network: {get_param: public_net}
network:
type: OS::Neutron::Net
subnet:
type: OS::Neutron::Subnet
properties:
network: {get_resource: network}
ip_version: 4
cidr: {get_param: subnet_cidr}
dns_nameservers: {get_param: dns_servers}
router:
type: OS::Neutron::Router
properties:
external_gateway_info:
network: {get_param: public_net}
router_interface:
type: OS::Neutron::RouterInterface
properties:
router: {get_resource: router}
subnet: {get_resource: subnet}
wait_handle:
type: OS::Heat::WaitConditionHandle
server:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: flavor}
networks:
- subnet: {get_resource: subnet}
security_groups:
- {get_resource: sg}
# Server without security groups
server2:
type: OS::Nova::Server
properties:
image: {get_param: image}
flavor: {get_param: flavor}
networks:
- subnet: {get_resource: subnet}
security_groups:
- {get_resource: sg2}
server_floating_ip_assoc:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip}
port_id: {get_attr: [server, addresses, {get_resource: network}, 0, port]}
server_floating_ip_assoc2:
type: OS::Neutron::FloatingIPAssociation
properties:
floatingip_id: {get_resource: floating_ip2}
port_id: {get_attr: [server2, addresses, {get_resource: network}, 0, port]}
outputs:
fip:
value: {get_attr: [floating_ip, floating_ip_address]}
fip2:
value: {get_attr: [floating_ip2, floating_ip_address]}
sg2:
value: {get_resource: sg2}

View File

@ -1,43 +0,0 @@
# Copyright (c) 2018 Red Hat
# All Rights Reserved.
#
# 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 __future__ import absolute_import
import testtools
from tobiko.tests.scenario import base
import tobiko.common.utils.network as net_utils
@testtools.skip("Broken or incomplete test case.")
class ContinuousPingTest(base.ScenarioTestsBase):
"""Tests server connectivity over time."""
MAX_PACKET_LOSS = 5
def setUp(self):
super(ContinuousPingTest, self).setUp()
self.stack = self._get_stack()
self.fip = self.stackManager.get_output(self.stack, "fip")
def test_pre_continuous_ping(self):
"""Starts the ping process."""
net_utils.run_background_ping(self.fip)
def test_post_continuous_ping(self):
"""Validates the ping test was successful."""
packet_loss = net_utils.get_packet_loss(self.fip)
self.assertLessEqual(int(packet_loss), self.MAX_PACKET_LOSS)

View File

@ -1,35 +0,0 @@
# Copyright (c) 2018 Red Hat
# All Rights Reserved.
#
# 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 __future__ import absolute_import
from tobiko.tests.scenario import base
from tobiko.common.asserts import assert_ping
class FloatingIPTest(base.ScenarioTestsBase):
"""Tests server connectivity"""
@classmethod
def setUpClass(cls):
super(FloatingIPTest, cls).setUpClass()
cls.fip = cls.stacks.get_output(cls.stack, "fip")
cls.unreachable_fip = cls.stacks.get_output(cls.stack, "fip2")
def test_ping_floating_ip(self):
"""Validates connectivity to a server post upgrade."""
assert_ping(self.fip)
def test_ping_unreachable_floating_ip(self):
assert_ping(self.unreachable_fip, should_fail=True)

View File

@ -1,69 +0,0 @@
# Copyright (c) 2018 Red Hat
# All Rights Reserved.
#
# 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 __future__ import absolute_import
from tempest.common import utils
from tobiko.common.asserts import assert_ping
from tobiko.tests.scenario import base
from testtools import skip
@skip("Broken or incomplete test case.")
class MTUTest(base.ScenarioTestsBase):
"""Tests MTU."""
@classmethod
def setUpClass(cls):
super(MTUTest, cls).setUpClass()
cls.fip_max_mtu = cls.stacks.get_output(cls.stack, "fip_max_mtu")
cls.net_max_mtu = cls.networks.client.show_network(
cls.stackManager.get_output(cls.stack, "network_max_mtu"))
cls.fip_min_mtu = cls.stacks.get_output(cls.stack, "fip_min_mtu")
cls.net_min_mtu = cls.networkManager.client.show_network(
cls.stackManager.get_output(cls.stack, "network_min_mtu"))
def test_ping_max_mtu(self):
assert_ping(self.fip_max_mtu)
def test_ping_min_mtu(self):
# Ping without fragmentation and without changing MTU should succeed
assert_ping(self.fip_min_mtu)
assert_ping(self.fip_min_mtu, should_fail=True,
mtu=self.net_min_mtu['network']['mtu'] + 100,
fragmentation=False)
@utils.requires_ext(extension="net-mtu-writable", service="network")
def test_post_writeable_mtu(self):
"""Validates writeable MTU post upgrade."""
# Assert ping without fragmentation still works
assert_ping(self.fip_min_mtu)
assert_ping(self.fip_max_mtu)
updated_min_mtu = self.net_min_mtu['network']['mtu'] + 100
assert_ping(self.fip_min_mtu, should_fail=True,
mtu=updated_min_mtu, fragmentation=False)
# Update MTU
self.networkManager.client.update_network(
self.net_min_mtu_id, body={'network': {'mtu': updated_min_mtu}})
assert_ping(self.fip_min_mtu, should_fail=False,
mtu=updated_min_mtu, fragmentation=False)

View File

@ -1,35 +0,0 @@
# Copyright (c) 2018 Red Hat
# All Rights Reserved.
#
# 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 __future__ import absolute_import
from tobiko.common.asserts import assert_ping
from tobiko.tests.scenario import base
class SecurityGroupTest(base.ScenarioTestsBase):
"""Tests security groups."""
@classmethod
def setUpClass(cls):
super(SecurityGroupTest, cls).setUpClass()
cls.fip = cls.stacks.get_output(cls.stack, "fip")
cls.unreachable_fip = cls.stacks.get_output(cls.stack, "fip2")
cls.blank_sg_id = cls.stacks.get_output(cls.stack, "sg2")
def test_ping_fip(self):
assert_ping(self.fip)
def test_ping_unreacheable_fip(self):
assert_ping(self.unreachable_fip, should_fail=True)