From 7436a003b1d033f126dbbbe188db5643e5fbf928 Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Mon, 6 Apr 2015 07:57:34 +0530 Subject: [PATCH] Fix NeutronLoadBalancerTest.test_neutron_loadbalancer timeout NeutronLoadBalancerTest.test_neutron_loadbalancer timeout happens occasionally. Added WaitCondition resource to signal back after SimpleHTTPServer is started. Change-Id: I73085d1b20277fba9f28460abaa991d489d2447a Closes-Bug: #1437203 --- .../templates/test_neutron_loadbalancer.yaml | 54 +++++++++++-------- .../scenario/test_neutron_loadbalancer.py | 5 +- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/heat_integrationtests/scenario/templates/test_neutron_loadbalancer.yaml b/heat_integrationtests/scenario/templates/test_neutron_loadbalancer.yaml index a7e9f9c98..a8c476938 100644 --- a/heat_integrationtests/scenario/templates/test_neutron_loadbalancer.yaml +++ b/heat_integrationtests/scenario/templates/test_neutron_loadbalancer.yaml @@ -17,6 +17,8 @@ parameters: port: type: string default: '80' + timeout: + type: number resources: sec_group: @@ -32,6 +34,31 @@ resources: - remote_ip_prefix: 0.0.0.0/0 protocol: icmp + wait_condition: + type: OS::Heat::WaitCondition + properties: + handle: { get_resource: wait_condition_handle } + count: 2 + timeout: { get_param: timeout } + + wait_condition_handle: + type: OS::Heat::WaitConditionHandle + + config: + type: OS::Heat::SoftwareConfig + properties: + group: ungrouped + config: + str_replace: + template: | + #!/bin/bash -v + echo $(hostname) > index.html + python -m SimpleHTTPServer port & + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + wc_notify: { get_attr: ['wait_condition_handle', 'curl_cli'] } + port: { get_param: port } + server1: type: OS::Nova::Server properties: @@ -40,17 +67,8 @@ resources: flavor: { get_param: flavor } key_name: { get_param: key_name } security_groups: [{ get_resource: sec_group }] - user_data: - list_join: - - '' - - - '#!/bin/bash -v - - ' - - 'echo $(hostname) > index.html - - ' - - 'python -m SimpleHTTPServer ' - - { get_param: port } + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: config } server2: type: OS::Nova::Server @@ -60,17 +78,8 @@ resources: flavor: { get_param: flavor } key_name: { get_param: key_name } security_groups: [{ get_resource: sec_group }] - user_data: - list_join: - - '' - - - '#!/bin/bash -v - - ' - - 'echo $(hostname) > index.html - - ' - - 'python -m SimpleHTTPServer ' - - { get_param: port } + user_data_format: SOFTWARE_CONFIG + user_data: { get_resource: config } health_monitor: type: OS::Neutron::HealthMonitor @@ -100,6 +109,7 @@ resources: LBaaS: type: OS::Neutron::LoadBalancer + depends_on: wait_condition properties: pool_id: { get_resource: test_pool } protocol_port: { get_param: port } diff --git a/heat_integrationtests/scenario/test_neutron_loadbalancer.py b/heat_integrationtests/scenario/test_neutron_loadbalancer.py index bbe85bc4c..fafa9bea6 100644 --- a/heat_integrationtests/scenario/test_neutron_loadbalancer.py +++ b/heat_integrationtests/scenario/test_neutron_loadbalancer.py @@ -55,7 +55,8 @@ class NeutronLoadBalancerTest(scenario_base.ScenarioTestsBase): 'flavor': self.conf.minimal_instance_type, 'image': self.conf.image_ref, 'private_subnet_id': self.net['subnets'][0], - 'external_network_id': self.public_net['id'] + 'external_network_id': self.public_net['id'], + 'timeout': self.conf.build_timeout } # Launch stack @@ -70,7 +71,7 @@ class NeutronLoadBalancerTest(scenario_base.ScenarioTestsBase): server1_ip = self._stack_output(stack, 'serv1_ip') server2_ip = self._stack_output(stack, 'serv2_ip') - # Check connection and info about received responces + # Check connection and info about received responses self.check_connectivity(server1_ip) self.collect_responses(server1_ip, {'server1\n'})