Sort the results

Results need to be sorted.  OpenSource Chef 11 doesn't preserve order.

Change-Id: I00e649f1833915f6372d7d59dcefc6c073aca29f
This commit is contained in:
John Dewey 2013-07-12 23:10:41 -07:00
parent 7dc0fdd164
commit ead7e5ded2
3 changed files with 4 additions and 4 deletions

@ -46,7 +46,7 @@ if node["openstack"]["mq"]["cluster"]
qs = "roles:#{rabbit_server_role} AND chef_environment:#{node.chef_environment}"
node.override["rabbitmq"]["cluster_disk_nodes"] = search(:node, qs).map do |n|
"#{user}@#{n['hostname']}"
end
end.sort
end
include_recipe "rabbitmq"

@ -36,7 +36,7 @@ describe "openstack-ops-messaging::rabbitmq-server" do
)
end
it "overrides cluster_disk_nodes" do
it "overrides and sorts cluster_disk_nodes" do
expect(@chef_run.node['rabbitmq']['cluster_disk_nodes']).to eql(
["guest@host1", "guest@host2"]
)

@ -19,8 +19,8 @@ def ops_messaging_stubs
::Chef::Recipe.any_instance.stub(:search).
with(:node, "roles:os-ops-messaging AND chef_environment:_default").
and_return [
{ 'hostname' => 'host1' },
{ 'hostname' => 'host2' }
{ 'hostname' => 'host2' },
{ 'hostname' => 'host1' }
]
::Chef::Recipe.any_instance.stub(:user_password).
and_return "rabbit-pass"