Merge branch 'master' into 13937-keepstore-prometheus
[arvados.git] / sdk / ruby / test / sdk_fixtures.rb
index 8af81cdcf4b26fd24ed66da8e95cdd4bc4be08e7..0f385e221877a38075571479057282f73147f51f 100644 (file)
@@ -1,3 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
 require "yaml"
 
 module SDKFixtures
@@ -7,6 +11,10 @@ module SDKFixtures
     def random_block(size=nil)
       sprintf("%032x+%d", rand(16 ** 32), size || rand(64 * 1024 * 1024))
     end
+
+    def random_blocks(count, size=nil)
+      (0...count).map { |_| random_block(size) }
+    end
   end
 
   extend StaticMethods
@@ -50,4 +58,17 @@ module SDKFixtures
   NONNORMALIZED_MANIFEST =
     ["./dir2 #{random_block} 0:0:z 0:0:y 0:0:x",
      "./dir1 #{random_block} 0:0:p 0:0:o 0:0:n\n"].join("\n")
+  MANIFEST_WITH_DIRS_IN_FILENAMES =
+    [". #{random_block(10)} 0:3:file1 3:3:dir1/file1 6:3:dir1/dir2/file1\n"].join("")
+  MULTILEVEL_MANIFEST_WITH_DIRS_IN_FILENAMES =
+    [". #{random_block(10)} 0:3:file1 3:3:dir1/file1 6:4:dir1/dir2/file1\n",
+     "./dir1 #{random_block(10)} 0:3:file1 3:7:dir2/file1\n"].join("")
+
+  ### Non-tree manifests
+  # These manifests follow the spec, but they express a structure that can't
+  # can't be represented by a POSIX filesystem tree.  For example, there's a
+  # name conflict between a stream and a filename.
+  NAME_CONFLICT_MANIFEST =
+    [". #{random_block(9)} 0:9:conflict",
+     "./conflict #{random_block} 0:0:name\n"].join("\n")
 end