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.
 
 
 
 

248 lines
9.8 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", "newfile.txt" ],
  122. "exit": 1,
  123. "stderr": "ERROR: file not found: 'test.txt'\n",
  124. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  125. },
  126. {
  127. "special": "copy newfile.txt to test.txt"
  128. },
  129. {
  130. "title": "copied file now has same metadata",
  131. "cmd": [ "list", "test.txt" ],
  132. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  133. },
  134. {
  135. "special": "verify store object cnt",
  136. "comment": "should have two file and one metadata",
  137. "count": 3
  138. },
  139. {
  140. "special": "change newfile.txt"
  141. },
  142. {
  143. "title": "newfile file is now not present",
  144. "cmd": [ "list", "newfile.txt" ],
  145. "exit": 1,
  146. "stderr": "ERROR: file not found: 'newfile.txt'\n"
  147. },
  148. {
  149. "title": "old file still has same metadata",
  150. "cmd": [ "list", "test.txt" ],
  151. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  152. },
  153. {
  154. "special": "verify store object cnt",
  155. "comment": "should have two file and one metadata",
  156. "count": 3
  157. },
  158. {
  159. "title": "test.txt in subdir t has same metadata",
  160. "cmd": [ "list", "t/newfile.txt" ],
  161. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  162. },
  163. {
  164. "special": "verify store object cnt",
  165. "comment": "and a obj was created for subdir",
  166. "count": 4
  167. },
  168. {
  169. "title": "that two files can be tagged at once",
  170. "cmd": [ "modify", "+random=", "--", "t/newfile.txt", "test.txt" ]
  171. },
  172. {
  173. "title": "that two files can be un-tagged at once",
  174. "cmd": [ "modify", "-random=", "t/newfile.txt", "test.txt" ]
  175. },
  176. {
  177. "special": "set hostid",
  178. "comment": "and that a modified hostid",
  179. "hostid": "ceaa4862-dd00-41ba-9787-7480ec1b2679"
  180. },
  181. {
  182. "title": "test.txt in subdir t has same metadata",
  183. "cmd": [ "list", "t/newfile.txt" ],
  184. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  185. },
  186. {
  187. "special": "verify store object cnt",
  188. "comment": "and a obj was created for the new host",
  189. "count": 5
  190. },
  191. {
  192. "title": "a common tag is disallowed",
  193. "cmd": [ "modify", "+modified=foo", "test.txt" ],
  194. "exit": 1,
  195. "stderr": "ERROR: invalid tag: ['modified'].\n"
  196. },
  197. {
  198. "title": "must be a + or -",
  199. "cmd": [ "modify", "modified=foo", "test.txt" ],
  200. "exit": 1,
  201. "stderr": "ERROR: file not found: 'modified=foo', or invalid tag specification.\n"
  202. },
  203. {
  204. "special": "iter is unique"
  205. },
  206. {
  207. "title": "dump is correct",
  208. "cmd": [ "dump" ],
  209. "exit": 0,
  210. "stdout_check": [
  211. { "name": "Changed Name", "type": "identity" },
  212. { "filename": "newfile.txt", "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "size": 19, "type": "file" },
  213. { "foo": [ "bar=baz" ], "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "type": "metadata" },
  214. { "filename": "test.txt", "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "size": 19, "type": "file" },
  215. { "filename": "newfile.txt", "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "size": 19, "type": "file" },
  216. { "filename": "newfile.txt", "hashes": [ "sha512:b0551b2fb5d045a74d36a08ac49aea66790ea4fb5e84f9326a32db44fc78ca0676e65a8d1f0d98f62589eeaef105f303c81f07f3f862ad3bace7960fe59de4d5" ], "size": 17, "type": "file" }
  217. ]
  218. },
  219. {
  220. "title": "that import can be done",
  221. "cmd": [ "import" ],
  222. "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"
  223. },
  224. {
  225. "special": "verify store object cnt",
  226. "comment": "and the objects were imported",
  227. "count": 7
  228. },
  229. {
  230. "title": "than an object can be dropped",
  231. "cmd": [ "drop", "25ec10e6-c3d0-4363-a762-899dade7f93c" ]
  232. },
  233. {
  234. "special": "verify store object cnt",
  235. "comment": "and the object was dropped",
  236. "count": 6
  237. },
  238. {
  239. "title": "than an object can be dropped",
  240. "cmd": [ "drop", "89544934-6ed9-46ca-b8d0-77c5209f798d" ]
  241. },
  242. {
  243. "special": "verify store object cnt",
  244. "comment": "and the object was dropped",
  245. "count": 5
  246. }
  247. ]