From d27759141ec5592fd5d76861efa77a55d07c90a8 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 25 Mar 2015 12:04:16 -0700 Subject: Fix remote hash ordering for unit tests Without this commit, the unit tests for the git provider changing multiple remotes mocks the remotes in a particular order. While in practice it doesn't matter which remote the update_remotes method updates first, the unit tests must be able to mock them in the correct order. For ruby 1.8.7, a Hash will not necessarily produce key value pairs in the same order on each run, which causes intermittent failures in the unit tests. This change sorts the :source property values before trying to update them, and updates the unit tests to expect the values in alphabetical order. --- lib/puppet/provider/vcsrepo/git.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index 9d3f7f3..000032e 100644 --- a/lib/puppet/provider/vcsrepo/git.rb +++ b/lib/puppet/provider/vcsrepo/git.rb @@ -142,7 +142,8 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) # we loop around the hash. Otherwise, we assume single url specified # in source property if @resource.value(:source).is_a?(Hash) - @resource.value(:source).each do |remote_name, remote_url| + @resource.value(:source).keys.sort.each do |remote_name| + remote_url = @resource.value(:source)[remote_name] at_path { do_update |= update_remote_url(remote_name, remote_url) } end else -- cgit v1.2.3