Skip to content

Commit

Permalink
fix tests and typo in airbnb#121
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy Samovskiy committed Mar 22, 2017
1 parent 29ecc8a commit d5a5081
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/synapse/config_generator/haproxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1112,10 +1112,10 @@ def update_backends_at(socket_file_path, watchers)

name, addr, state = re.match(line)[1..3]

next if ['FRONTEND', 'BACKEND'].include?(address)
next if ['FRONTEND', 'BACKEND'].include?(addr)

cur_backends[name] ||= {}
cur_backends[name][address] = state
cur_backends[name][addr] = state
end

# build a list of backends that should be enabled
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/synapse/haproxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class MockWatcher; end;
end

it 'does not cause a restart due to the socket' do
mock_socket_output = "example_service,somehost:5555"
mock_socket_output = "example_service,somehost:5555,0,0,0,0,200,0,0,0,0,0,,0,0,0,0,DOWN,0,"
allow(subject).to receive(:talk_to_socket).with(socket_file_path, "show stat\n").and_return mock_socket_output

expect(subject).to receive(:talk_to_socket).exactly(:once).with(
Expand All @@ -192,9 +192,9 @@ class MockWatcher; end;
end

it 'disables existing servers on the socket' do
mock_socket_output = "example_service,somehost:5555\ndisabled_watcher,somehost:5555"
mock_socket_output = "example_service,somehost:5555,0,0,0,0,200,0,0,0,0,0,,0,0,0,0,DOWN,0,\ndisabled_watcher,somehost:5555,0,0,0,0,200,0,0,0,0,0,,0,0,0,0,UP,0,"
allow(subject).to receive(:talk_to_socket).with(socket_file_path, "show stat\n").and_return mock_socket_output

stub_const('Synapse::ConfigGenerator::Haproxy::HAPROXY_CMD_BATCH_SIZE', 1)

expect(subject).to receive(:talk_to_socket).exactly(:once).with(
socket_file_path, "enable server example_service/somehost:5555\n"
Expand Down

0 comments on commit d5a5081

Please sign in to comment.