about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--test/exec.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/exec.rb b/test/exec.rb
index 3c98369..b2c2bf9 100644
--- a/test/exec.rb
+++ b/test/exec.rb
@@ -12,8 +12,10 @@ module TestExec
   def uuid
     SecureRandom.uuid
   rescue NoMethodError
-    require "uuid"
-    UUID.generate
+    ary = SecureRandom.random_bytes(16).unpack("NnnnnN")
+    ary[2] = (ary[2] & 0x0fff) | 0x4000
+    ary[3] = (ary[3] & 0x3fff) | 0x8000
+    "%08x-%04x-%04x-%04x-%04x%08x" % ary
   end
 
   def yield_for_monitor_update # mogilefsd should update every 4 seconds