MetaData Sharing
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

247 lines
9.6 KiB

  1. [
  2. {
  3. "title": "Test no ident",
  4. "cmd": [ "list", "afile" ],
  5. "exit": 1,
  6. "stderr": "ERROR: Identity not created, create w/ genident.\n"
  7. },
  8. {
  9. "title": "gen ident",
  10. "cmd": [ "genident", "name=A Test User" ],
  11. "exit": 0
  12. },
  13. {
  14. "title": "gen ident",
  15. "cmd": [ "genident", "name=A Test User" ],
  16. "exit": 1,
  17. "stderr": "Error: Identity already created.\n"
  18. },
  19. {
  20. "title": "print ident",
  21. "cmd": [ "ident" ],
  22. "comment": "XXX - expand modified, pubkey and sig, and fix to base58 encode",
  23. "stdout_re": "^type:\tidentity\nuuid:\t[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\nmodified:\t[0-9]{4,}-[01][0-9]-[0-3][0-9] .*\nname:\tA Test User\npubkey:\t.*\nsig:\t.*\n",
  24. "exit": 0
  25. },
  26. {
  27. "title": "update ident",
  28. "cmd": [ "ident", "name=Changed Name" ],
  29. "exit": 0
  30. },
  31. {
  32. "title": "ident updated",
  33. "cmd": [ "ident" ],
  34. "comment": "create vars store bindings between tests?",
  35. "stdout_re": "^type:\tidentity\nuuid:\t[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\nmodified:\t[0-9]{4,}-[01][0-9]-[0-3][0-9] .*\nname:\tChanged Name\npubkey:\t.*\nsig:\t.*\n",
  36. "exit": 0
  37. },
  38. {
  39. "title": "pub key is base58 encoded",
  40. "cmd": [ "pubkey" ],
  41. "stdout_re": "^[1-9A-HJ-NP-Za-km-z]+\n$",
  42. "exit": 0
  43. },
  44. {
  45. "title": "Test file with no tag",
  46. "cmd": [ "list", "newfile.txt" ],
  47. "exit": 1,
  48. "stderr": "ERROR: file not found: 'newfile.txt'\n"
  49. },
  50. {
  51. "title": "invalid tag",
  52. "cmd": [ "modify", "+tag", "newfile.txt" ],
  53. "exit": 1,
  54. "stderr": "ERROR: invalid tag, needs an \"=\".\n"
  55. },
  56. {
  57. "title": "add tag",
  58. "cmd": [ "modify", "+tag=", "+dc:creator=John-Mark Gurney", "newfile.txt" ]
  59. },
  60. {
  61. "special": "verify store object cnt",
  62. "comment": "should only have one file and one metadata",
  63. "count": 2
  64. },
  65. {
  66. "title": "verify first tags are present",
  67. "cmd": [ "list", "newfile.txt" ],
  68. "stdout_re": "dc:creator:\tJohn-Mark Gurney\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  69. },
  70. {
  71. "title": "add duplicate ms:tag's",
  72. "cmd": [ "modify", "+ms:tag=foo", "+ms:tag=foo", "newfile.txt" ]
  73. },
  74. {
  75. "title": "but dup tags are not dup'd",
  76. "cmd": [ "list", "newfile.txt" ],
  77. "stdout_re": "dc:creator:\tJohn-Mark Gurney\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nms:tag:\tfoo\nsig:\t.*\ntag:\t\n"
  78. },
  79. {
  80. "title": "drop ms:tag",
  81. "cmd": [ "modify", "-ms:tag=foo", "newfile.txt" ]
  82. },
  83. {
  84. "title": "add tag",
  85. "cmd": [ "modify", "+dc:creator=Another user", "newfile.txt" ]
  86. },
  87. {
  88. "title": "another dc:creator tag is present",
  89. "cmd": [ "list", "newfile.txt" ],
  90. "stdout_re": "dc:creator:\tAnother user\ndc:creator:\tJohn-Mark Gurney\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  91. },
  92. {
  93. "title": "remove specific tag",
  94. "cmd": [ "modify", "-dc:creator=Another user", "newfile.txt" ]
  95. },
  96. {
  97. "title": "another dc:creator tag is present",
  98. "cmd": [ "list", "newfile.txt" ],
  99. "stdout_re": "dc:creator:\tJohn-Mark Gurney\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  100. },
  101. {
  102. "title": "remove all dc:creator tags",
  103. "cmd": [ "modify", "-dc:creator", "newfile.txt" ]
  104. },
  105. {
  106. "title": "that all dc:creator tags are removed",
  107. "cmd": [ "list", "newfile.txt" ],
  108. "stdout_re": "hashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  109. },
  110. {
  111. "title": "tag value w/ equals",
  112. "cmd": [ "modify", "+foo=bar=baz", "newfile.txt" ]
  113. },
  114. {
  115. "title": "print file",
  116. "cmd": [ "list", "newfile.txt" ],
  117. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  118. },
  119. {
  120. "title": "test file is not present",
  121. "cmd": [ "list", "test.txt" ],
  122. "exit": 1,
  123. "stderr": "ERROR: file not found: 'test.txt'\n"
  124. },
  125. {
  126. "special": "copy newfile.txt to test.txt"
  127. },
  128. {
  129. "title": "copied file now has same metadata",
  130. "cmd": [ "list", "test.txt" ],
  131. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  132. },
  133. {
  134. "special": "verify store object cnt",
  135. "comment": "should have two file and one metadata",
  136. "count": 3
  137. },
  138. {
  139. "special": "change newfile.txt"
  140. },
  141. {
  142. "title": "newfile file is now not present",
  143. "cmd": [ "list", "newfile.txt" ],
  144. "exit": 1,
  145. "stderr": "ERROR: file not found: 'newfile.txt'\n"
  146. },
  147. {
  148. "title": "old file still has same metadata",
  149. "cmd": [ "list", "test.txt" ],
  150. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  151. },
  152. {
  153. "special": "verify store object cnt",
  154. "comment": "should have two file and one metadata",
  155. "count": 3
  156. },
  157. {
  158. "title": "test.txt in subdir t has same metadata",
  159. "cmd": [ "list", "t/newfile.txt" ],
  160. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  161. },
  162. {
  163. "special": "verify store object cnt",
  164. "comment": "and a obj was created for subdir",
  165. "count": 4
  166. },
  167. {
  168. "title": "that two files can be tagged at once",
  169. "cmd": [ "modify", "+random=", "--", "t/newfile.txt", "test.txt" ]
  170. },
  171. {
  172. "title": "that two files can be un-tagged at once",
  173. "cmd": [ "modify", "-random=", "t/newfile.txt", "test.txt" ]
  174. },
  175. {
  176. "special": "set hostid",
  177. "comment": "and that a modified hostid",
  178. "hostid": "ceaa4862-dd00-41ba-9787-7480ec1b2679"
  179. },
  180. {
  181. "title": "test.txt in subdir t has same metadata",
  182. "cmd": [ "list", "t/newfile.txt" ],
  183. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  184. },
  185. {
  186. "special": "verify store object cnt",
  187. "comment": "and a obj was created for the new host",
  188. "count": 5
  189. },
  190. {
  191. "title": "a common tag is disallowed",
  192. "cmd": [ "modify", "+modified=foo", "test.txt" ],
  193. "exit": 1,
  194. "stderr": "ERROR: invalid tag: ['modified'].\n"
  195. },
  196. {
  197. "title": "must be a + or -",
  198. "cmd": [ "modify", "modified=foo", "test.txt" ],
  199. "exit": 1,
  200. "stderr": "ERROR: file not found: 'modified=foo', or invalid tag specification.\n"
  201. },
  202. {
  203. "special": "iter is unique"
  204. },
  205. {
  206. "title": "dump is correct",
  207. "cmd": [ "dump" ],
  208. "exit": 0,
  209. "stdout_check": [
  210. { "name": "Changed Name", "type": "identity" },
  211. { "filename": "newfile.txt", "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "size": 19, "type": "file" },
  212. { "foo": [ "bar=baz" ], "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "type": "metadata" },
  213. { "filename": "test.txt", "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "size": 19, "type": "file" },
  214. { "filename": "newfile.txt", "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "size": 19, "type": "file" },
  215. { "filename": "newfile.txt", "hashes": [ "sha512:b0551b2fb5d045a74d36a08ac49aea66790ea4fb5e84f9326a32db44fc78ca0676e65a8d1f0d98f62589eeaef105f303c81f07f3f862ad3bace7960fe59de4d5" ], "size": 17, "type": "file" }
  216. ]
  217. },
  218. {
  219. "title": "that import can be done",
  220. "cmd": [ "import" ],
  221. "stdin": "{\"created_by_ref\": \"e7ad5ea1-1203-4951-9dca-ec852a7b8166\", \"foo\": [\"bar=baz\"], \"hashes\": [\"sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\"], \"modified\": \"2022-08-21T00:13:51.245871Z\", \"sig\": \"g7k4plXjzz9y8YwJM2ncCIxaqlBpdbITPvKlDtfO7LSFmbZ-qcj0M0lN9h8twNU-n163dNsDGmQA4_s8pJB0liBHDwkjpYQvxfeztQDWNaVN7Xnh2MOj-wBzUbLTVnsJULXwVQrUjngzWjjGQ3jy6gwA\", \"tag\": [\"\"], \"type\": \"metadata\", \"uuid\": \"25ec10e6-c3d0-4363-a762-899dade7f93c\"}\n{\"created_by_ref\": \"2de7a389-410c-4755-8c62-f3254c7e971e\", \"dir\": \"\", \"filename\": \"FreeBSD-14.0-CURRENT-arm64-aarch64-ROCK64-20220331-d53927b0bae-254105.img.xz\", \"hashes\": [\"sha512:3eba2aa09a79fd7adec32ace93c6725e75b91a55192b5bfa827b893fae1c2cdbc040e282138387797f245c1f27da5e8ff7a02f59ff75c73b3d999d1e0a8752ad\"], \"id\": \"d9e8fc1a-9794-5e70-b67b-11d708ec8947\", \"modified\": \"2022-08-02T07:52:50.216428Z\", \"mtime\": \"2022-03-31T10:15:14.000000Z\", \"sig\": \"F3Ch1BQB57RAgFNKNF5btCRZS3jFmafhvcdoWuu6WHo5JzyhuQ7jNvZkv4tzgWqlMfPecLJMMmSAMcwqorykDWi854ZfKUm3F-JOTk8R7qRKdHd23rwVGDEXtVHv-kynkh8WemPsfc2V1HT8JKG9NhwA\", \"size\": 551750948, \"type\": \"file\", \"uuid\": \"89544934-6ed9-46ca-b8d0-77c5209f798d\"}\n"
  222. },
  223. {
  224. "special": "verify store object cnt",
  225. "comment": "and the objects were imported",
  226. "count": 7
  227. },
  228. {
  229. "title": "than an object can be dropped",
  230. "cmd": [ "drop", "25ec10e6-c3d0-4363-a762-899dade7f93c" ]
  231. },
  232. {
  233. "special": "verify store object cnt",
  234. "comment": "and the object was dropped",
  235. "count": 6
  236. },
  237. {
  238. "title": "than an object can be dropped",
  239. "cmd": [ "drop", "89544934-6ed9-46ca-b8d0-77c5209f798d" ]
  240. },
  241. {
  242. "special": "verify store object cnt",
  243. "comment": "and the object was dropped",
  244. "count": 5
  245. }
  246. ]