summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-09-07 05:40:52 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-09-07 05:40:52 +0000
commitedc392d7f5b8fb59fff17091612da01a5a52891d (patch)
tree40cfd99a9ac56a6b40bd5b0727df5e489b257926
parent4cc12a85baf2617ad9d60d521249e24ffdefcd53 (diff)
downloadpuppet-edc392d7f5b8fb59fff17091612da01a5a52891d.tar.gz
puppet-edc392d7f5b8fb59fff17091612da01a5a52891d.tar.xz
puppet-edc392d7f5b8fb59fff17091612da01a5a52891d.zip
adding a break if randomization takes too long
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@634 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xtest/types/tc_component.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/types/tc_component.rb b/test/types/tc_component.rb
index 728c19b73..0582ee6f8 100755
--- a/test/types/tc_component.rb
+++ b/test/types/tc_component.rb
@@ -25,7 +25,13 @@ class TestComponent < TestPuppet
def randnum(limit)
num = nil
+ looped = 0
loop do
+ looped += 1
+ if looped > 1000
+ $stderr.print "Reached limit of looping"
+ break
+ end
num = rand(limit)
unless @@used.include?(num)
@@used[num] = true