Skip to content

Commit

Permalink
test: extract dependencies test for multiple outputs case
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 30, 2014
1 parent aa6f228 commit 6be519c
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions test/unit/plugin/distributor/test_search_planner.rb
Expand Up @@ -22,6 +22,10 @@ def plan(search_request)
planner.messages
end

def messages
@messages ||= plan(@request)
end

def broadcast_message(messages)
messages.find do |message|
message["type"] == "broadcast"
Expand Down Expand Up @@ -75,6 +79,39 @@ def setup
}
end

def test_dependencies
search_reduce_inputs = [
"errors",
"query1",
"query2",
"query3",
]
search_gather_inputs = [
"errors_reduced",
"query1_reduced",
"query2_reduced",
"query3_reduced",
]
assert_equal([
{
"type" => "search_reduce",
"inputs" => search_reduce_inputs,
"outputs" => search_gather_inputs,
},
{
"type" => "search_gather",
"inputs" => search_gather_inputs,
"outputs" => nil,
},
{
"type" => "broadcast",
"inputs" => nil,
"outputs" => search_reduce_inputs,
},
],
dependencies(messages))
end

def test_distribute
expected_plan = []

Expand Down Expand Up @@ -1102,10 +1139,6 @@ def setup
}
end

def messages
@messages ||= plan(@request)
end

def test_dependencies
search_reduce_inputs = [
"errors",
Expand Down

0 comments on commit 6be519c

Please sign in to comment.