Skip to content

Commit

Permalink
(maint) Support multiple targets again
Browse files Browse the repository at this point in the history
With pcp-broker 1.0, we removed the ability to address multiple targets.
Acceptance test code still relied on it, so that a run with more than
one agent configured would fail. Update the code to send individual
messages for each target so it works again.
  • Loading branch information
MikaelSmith committed Jun 29, 2017
1 parent 92022ea commit df2402f
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions acceptance/lib/pxp-agent/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,6 @@ def rpc_request(broker, targets,
end
end

message = PCP::Message.new({
:message_type => blocking ? 'http://puppetlabs.com/rpc_blocking_request' : 'http://puppetlabs.com/rpc_non_blocking_request',
:targets => targets
})

message_data = {
:transaction_id => transaction_id,
:module => pxp_module,
Expand All @@ -305,13 +300,22 @@ def rpc_request(broker, targets,
if !blocking then
message_data[:notify_outcome] = false
end
message.data = message_data.to_json

message_expiry = 10 # Seconds for the PCP message to be considered failed
rpc_action_expiry = 60 # Seconds for the entire RPC action to be considered failed
message.expires(message_expiry)
targets.each do |target|
message = PCP::Message.new({
:message_type => blocking ? 'http://puppetlabs.com/rpc_blocking_request' : 'http://puppetlabs.com/rpc_non_blocking_request',
:targets => [target]
})

client.send(message)
message.data = message_data.to_json

message_expiry = 10 # Seconds for the PCP message to be considered failed
message.expires(message_expiry)

client.send(message)
end

rpc_action_expiry = 60 # Seconds for the entire RPC action to be considered failed

begin
Timeout::timeout(rpc_action_expiry) do
Expand Down

0 comments on commit df2402f

Please sign in to comment.