Permalink
Browse files

Merge "Fix instance listening function bug and unit test bug" into se…

…rvices-r9
  • Loading branch information...
2 parents 9e3e658 + e9bd901 commit 02fe50d65f61eef21880b98f470f0c855d6ed08d Tang Rui committed with Gerrit Code Review Mar 2, 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 02fe50d

Please sign in to comment.