Merge "Revert "Use Ubuntu server instance as octavia members""
This commit is contained in:
commit
d95374c4ed
@ -92,4 +92,8 @@ OctaviaLoadbalancerStackFixture = _octavia.OctaviaLoadbalancerStackFixture
|
||||
OctaviaListenerStackFixture = _octavia.OctaviaListenerStackFixture
|
||||
OctaviaPoolStackFixture = _octavia.OctaviaPoolStackFixture
|
||||
OctaviaMemberServerStackFixture = _octavia.OctaviaMemberServerStackFixture
|
||||
OctaviaServerStackFixture = _octavia.OctaviaServerStackFixture
|
||||
OctaviaClientServerStackFixture = _octavia.OctaviaClientServerStackFixture
|
||||
OctaviaOtherServerStackFixture = _octavia.OctaviaOtherServerStackFixture
|
||||
OctaviaOtherMemberServerStackFixture = (
|
||||
_octavia.OctaviaOtherMemberServerStackFixture)
|
||||
|
@ -20,10 +20,10 @@ from oslo_log import log
|
||||
import tobiko
|
||||
from tobiko import config
|
||||
from tobiko.openstack import heat
|
||||
from tobiko.openstack.stacks import _centos
|
||||
from tobiko.openstack.stacks import _cirros
|
||||
from tobiko.openstack.stacks import _hot
|
||||
from tobiko.openstack.stacks import _neutron
|
||||
from tobiko.openstack.stacks import _ubuntu
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
@ -36,6 +36,53 @@ class OctaviaVipNetworkStackFixture(_neutron.NetworkStackFixture):
|
||||
port_security_enabled = True
|
||||
|
||||
|
||||
class OctaviaMemberNetworkStackFixture(_neutron.NetworkStackFixture):
|
||||
pass
|
||||
|
||||
|
||||
class OctaviaCentosServerStackFixture(_centos.CentosServerStackFixture):
|
||||
network_stack = tobiko.required_setup_fixture(
|
||||
OctaviaMemberNetworkStackFixture)
|
||||
|
||||
@property
|
||||
def user_data(self):
|
||||
# Launch a webserver on port 80 that replies the server name to the
|
||||
# client
|
||||
return ("#cloud-config\n"
|
||||
"packages:\n"
|
||||
"- httpd\n"
|
||||
"runcmd:\n"
|
||||
"- [ sh, -c, \"hostname > /var/www/html/id\" ]\n"
|
||||
"- [ systemctl, enable, --now, httpd ]\n")
|
||||
|
||||
|
||||
class OctaviaCirrosServerStackFixture(_cirros.CirrosServerStackFixture):
|
||||
network_stack = tobiko.required_setup_fixture(
|
||||
OctaviaMemberNetworkStackFixture)
|
||||
|
||||
@property
|
||||
def user_data(self):
|
||||
# Launch a webserver on port 80 that replies the server name to the
|
||||
# client
|
||||
# This webserver relies on the nc command which may fail if multiple
|
||||
# clients connect at the same time. For concurrency testing,
|
||||
# OctaviaCentosServerStackFixture is more suited to handle multiple
|
||||
# requests.
|
||||
|
||||
return (
|
||||
"#!/bin/sh\n"
|
||||
"sudo nc -k -p 80 -e echo -e \"HTTP/1.1 200 OK\r\n"
|
||||
"Content-Length: $(hostname | head -c-1 | wc -c )\r\n"
|
||||
"Server: $(hostname)\r\n"
|
||||
"Content-type: text/html; charset=utf-8\r\n"
|
||||
"Connection: close\r\n\r\n"
|
||||
"$(hostname)\"\n")
|
||||
|
||||
|
||||
class OctaviaServerStackFixture(OctaviaCirrosServerStackFixture):
|
||||
pass
|
||||
|
||||
|
||||
class OctaviaLoadbalancerStackFixture(heat.HeatStackFixture):
|
||||
template = _hot.heat_template_file('octavia/load_balancer.yaml')
|
||||
|
||||
@ -97,10 +144,7 @@ class OctaviaMemberServerStackFixture(heat.HeatStackFixture):
|
||||
|
||||
pool = tobiko.required_setup_fixture(OctaviaPoolStackFixture)
|
||||
|
||||
@property
|
||||
def server_stack(self):
|
||||
return tobiko.setup_fixture(_ubuntu.UbuntuServerStackFixture,
|
||||
fixture_id=self.fixture_id)
|
||||
server_stack = tobiko.required_setup_fixture(OctaviaServerStackFixture)
|
||||
|
||||
application_port = 80
|
||||
|
||||
@ -132,3 +176,14 @@ class OctaviaMemberServerStackFixture(heat.HeatStackFixture):
|
||||
class OctaviaClientServerStackFixture(_cirros.CirrosServerStackFixture):
|
||||
network_stack = tobiko.required_setup_fixture(
|
||||
OctaviaVipNetworkStackFixture)
|
||||
|
||||
|
||||
class OctaviaOtherServerStackFixture(
|
||||
OctaviaServerStackFixture):
|
||||
pass
|
||||
|
||||
|
||||
class OctaviaOtherMemberServerStackFixture(
|
||||
OctaviaMemberServerStackFixture):
|
||||
server_stack = tobiko.required_setup_fixture(
|
||||
OctaviaOtherServerStackFixture)
|
||||
|
@ -43,8 +43,7 @@ class OctaviaBasicTrafficScenarioTest(testtools.TestCase):
|
||||
stacks.OctaviaMemberServerStackFixture)
|
||||
|
||||
member2_stack = tobiko.required_setup_fixture(
|
||||
stacks.OctaviaMemberServerStackFixture,
|
||||
fixture_id=1)
|
||||
stacks.OctaviaOtherMemberServerStackFixture)
|
||||
|
||||
client_stack = tobiko.required_setup_fixture(
|
||||
stacks.OctaviaClientServerStackFixture)
|
||||
|
Loading…
Reference in New Issue
Block a user