Permalink
Browse files

(Maint) Lenient checks for looked up data

There were two tests that were dependent on the order in which a hash
was tranversed. This caused tests to fail sometimes on certain
platforms. This changes those tests to use simpler data and a regex to
check for that data so that order is no longer important
  • Loading branch information...
1 parent cc209f0 commit f0f89cabdd8dadc644e1af0f5fad3f4515d458a7 @zaphod42 zaphod42 committed Sep 25, 2012
@@ -10,12 +10,8 @@
users:
pete:
uid: 2000
- gid: 2000
- shell: '/bin/bash'
tom:
uid: 2001
- gid: 2001
- shell: '/bin/bash'
"
}
PP
@@ -36,9 +32,8 @@
step "Try to lookup hash data"
on master, hiera("users"), :acceptable_exit_codes => [0] do
- assert_output <<-OUTPUT
- {"tom"=>{"gid"=>2001, "uid"=>2001, "shell"=>"/bin/bash"}, "pete"=>{"gid"=>2000, "uid"=>2000, "shell"=>"/bin/bash"}}
- OUTPUT
+ assert_match /tom[^}]+"uid"=>2001}/, result.output
+ assert_match /pete[^}]+"uid"=>2000}/, result.output
end
ensure step "Teardown"
@@ -7,9 +7,7 @@
content => "---
users:
joe:
- gid: 1000
uid: 1000
- home: '/home/joe'
"
}
@@ -18,9 +16,7 @@
content => "---
users:
pete:
- gid: 1001
uid: 1001
- home: '/home/pete'
"
}
@@ -35,9 +31,8 @@
step "Try to lookup data using hash search"
on master, hiera('users', '--yaml', '/etc/puppet/scope.yaml', '--hash'),
:acceptable_exit_codes => [0] do
- assert_output <<-OUTPUT
- STDOUT> {"joe"=>{"gid"=>1000, "uid"=>1000, "home"=>"/home/joe"}, "pete"=>{"gid"=>1001, "uid"=>1001, "home\"=>"/home/pete"}}
- OUTPUT
+ assert_match /joe[^}]+"uid"=>1000}/, result.output
+ assert_match /pete[^}]+"uid"=>1001}/, result.output
end
ensure step "Teardown"

0 comments on commit f0f89ca

Please sign in to comment.