Permalink
Browse files

Fix instance listening function bug and unit test bug

Change-Id: Ia4c07d730632776f3eccfb1e90da1edbe8fd8582
  • Loading branch information...
1 parent 5c0cc39 commit e9bd9018865a061064418f071598ce3d4fe78c24 Tang Rui committed Mar 1, 2012
Showing with 7 additions and 3 deletions.
  1. +3 −3 rabbit/lib/rabbit_service/rabbit_node.rb
  2. +4 −0 rabbit/spec/spec_helper.rb
@@ -38,9 +38,9 @@ class ProvisionedService
property :memory, Integer, :required => true
property :status, Integer, :default => 0
- def listening?
+ def listening?(interface_ip, instance_port=port)
begin
- TCPSocket.open("localhost", port).close
+ TCPSocket.open(interface_ip, instance_port).close
return true
rescue => e
return false
@@ -320,7 +320,7 @@ def start_provisioned_instances
end
@capacity -= capacity_unit
- if instance.listening?
+ if instance.listening?(@local_ip)
@logger.warn("Service #{instance.name} already running on port #{instance.port}")
next
end
@@ -44,6 +44,10 @@ def config_base_dir
def getNodeTestConfig
config_file = File.join(config_base_dir, "rabbit_node.yml")
+ # The configuration file name could be "rabbitmq_node.yml" in dev_setup environment
+ if !File.exist?(config_file)
+ config_file = File.join(config_base_dir, "rabbitmq_node.yml")
+ end
config = YAML.load_file(config_file)
options = {
:logger => getLogger,

0 comments on commit e9bd901

Please sign in to comment.