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.
 
 
 
 

259 lines
10 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": "Test file with no tag, with --empty --json",
  52. "cmd": [ "list", "--json", "--empty", "newfile.txt" ],
  53. "exit": 0,
  54. "stdout": "{}\n"
  55. },
  56. {
  57. "title": "invalid tag",
  58. "cmd": [ "modify", "+tag", "newfile.txt" ],
  59. "exit": 1,
  60. "stderr": "ERROR: invalid tag, needs an \"=\".\n"
  61. },
  62. {
  63. "title": "add tag",
  64. "cmd": [ "modify", "+tag=", "+dc:creator=John-Mark Gurney", "newfile.txt" ]
  65. },
  66. {
  67. "special": "verify store object cnt",
  68. "comment": "should only have one file and one metadata",
  69. "count": 2
  70. },
  71. {
  72. "title": "verify first tags are present",
  73. "cmd": [ "list", "newfile.txt" ],
  74. "stdout_re": "dc:creator:\tJohn-Mark Gurney\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  75. },
  76. {
  77. "title": "verify --json works",
  78. "cmd": [ "list", "--json", "newfile.txt" ],
  79. "stdout_check": [ { "dc:creator": [ "John-Mark Gurney" ], "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "tag": [ "" ], "type": "metadata" } ]
  80. },
  81. {
  82. "title": "add duplicate ms:tag's",
  83. "cmd": [ "modify", "+ms:tag=foo", "+ms:tag=foo", "newfile.txt" ]
  84. },
  85. {
  86. "title": "but dup tags are not dup'd",
  87. "cmd": [ "list", "newfile.txt" ],
  88. "stdout_re": "dc:creator:\tJohn-Mark Gurney\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nms:tag:\tfoo\nsig:\t.*\ntag:\t\n"
  89. },
  90. {
  91. "title": "drop ms:tag",
  92. "cmd": [ "modify", "-ms:tag=foo", "newfile.txt" ]
  93. },
  94. {
  95. "title": "add tag",
  96. "cmd": [ "modify", "+dc:creator=Another user", "newfile.txt" ]
  97. },
  98. {
  99. "title": "another dc:creator tag is present",
  100. "cmd": [ "list", "newfile.txt" ],
  101. "stdout_re": "dc:creator:\tAnother user\ndc:creator:\tJohn-Mark Gurney\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  102. },
  103. {
  104. "title": "remove specific tag",
  105. "cmd": [ "modify", "-dc:creator=Another user", "newfile.txt" ]
  106. },
  107. {
  108. "title": "another dc:creator tag is present",
  109. "cmd": [ "list", "newfile.txt" ],
  110. "stdout_re": "dc:creator:\tJohn-Mark Gurney\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  111. },
  112. {
  113. "title": "remove all dc:creator tags",
  114. "cmd": [ "modify", "-dc:creator", "newfile.txt" ]
  115. },
  116. {
  117. "title": "that all dc:creator tags are removed",
  118. "cmd": [ "list", "newfile.txt" ],
  119. "stdout_re": "hashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  120. },
  121. {
  122. "title": "tag value w/ equals",
  123. "cmd": [ "modify", "+foo=bar=baz", "newfile.txt" ]
  124. },
  125. {
  126. "title": "print file",
  127. "cmd": [ "list", "newfile.txt" ],
  128. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  129. },
  130. {
  131. "title": "test file is not present",
  132. "cmd": [ "list", "test.txt", "newfile.txt" ],
  133. "exit": 1,
  134. "stderr": "ERROR: file not found: 'test.txt'\n",
  135. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  136. },
  137. {
  138. "special": "copy newfile.txt to test.txt"
  139. },
  140. {
  141. "title": "copied file now has same metadata",
  142. "cmd": [ "list", "test.txt" ],
  143. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  144. },
  145. {
  146. "special": "verify store object cnt",
  147. "comment": "should have two file and one metadata",
  148. "count": 3
  149. },
  150. {
  151. "special": "change newfile.txt"
  152. },
  153. {
  154. "title": "newfile file is now not present",
  155. "cmd": [ "list", "newfile.txt" ],
  156. "exit": 1,
  157. "stderr": "ERROR: file not found: 'newfile.txt'\n"
  158. },
  159. {
  160. "title": "old file still has same metadata",
  161. "cmd": [ "list", "test.txt" ],
  162. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  163. },
  164. {
  165. "special": "verify store object cnt",
  166. "comment": "should have two file and one metadata",
  167. "count": 3
  168. },
  169. {
  170. "title": "test.txt in subdir t has same metadata",
  171. "cmd": [ "list", "t/newfile.txt" ],
  172. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  173. },
  174. {
  175. "special": "verify store object cnt",
  176. "comment": "and a obj was created for subdir",
  177. "count": 4
  178. },
  179. {
  180. "title": "that two files can be tagged at once",
  181. "cmd": [ "modify", "+random=", "--", "t/newfile.txt", "test.txt" ]
  182. },
  183. {
  184. "title": "that two files can be un-tagged at once",
  185. "cmd": [ "modify", "-random=", "t/newfile.txt", "test.txt" ]
  186. },
  187. {
  188. "special": "set hostid",
  189. "comment": "and that a modified hostid",
  190. "hostid": "ceaa4862-dd00-41ba-9787-7480ec1b2679"
  191. },
  192. {
  193. "title": "test.txt in subdir t has same metadata",
  194. "cmd": [ "list", "t/newfile.txt" ],
  195. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  196. },
  197. {
  198. "special": "verify store object cnt",
  199. "comment": "and a obj was created for the new host",
  200. "count": 5
  201. },
  202. {
  203. "title": "a common tag is disallowed",
  204. "cmd": [ "modify", "+modified=foo", "test.txt" ],
  205. "exit": 1,
  206. "stderr": "ERROR: invalid tag: ['modified'].\n"
  207. },
  208. {
  209. "title": "must be a + or -",
  210. "cmd": [ "modify", "modified=foo", "test.txt" ],
  211. "exit": 1,
  212. "stderr": "ERROR: file not found: 'modified=foo', or invalid tag specification.\n"
  213. },
  214. {
  215. "special": "iter is unique"
  216. },
  217. {
  218. "title": "dump is correct",
  219. "cmd": [ "dump" ],
  220. "exit": 0,
  221. "stdout_check": [
  222. { "name": "Changed Name", "type": "identity" },
  223. { "filename": "newfile.txt", "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "size": 19, "type": "file" },
  224. { "foo": [ "bar=baz" ], "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "type": "metadata" },
  225. { "filename": "test.txt", "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "size": 19, "type": "file" },
  226. { "filename": "newfile.txt", "hashes": [ "sha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c" ], "size": 19, "type": "file" },
  227. { "filename": "newfile.txt", "hashes": [ "sha512:b0551b2fb5d045a74d36a08ac49aea66790ea4fb5e84f9326a32db44fc78ca0676e65a8d1f0d98f62589eeaef105f303c81f07f3f862ad3bace7960fe59de4d5" ], "size": 17, "type": "file" }
  228. ]
  229. },
  230. {
  231. "title": "that import can be done",
  232. "cmd": [ "import" ],
  233. "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"
  234. },
  235. {
  236. "special": "verify store object cnt",
  237. "comment": "and the objects were imported",
  238. "count": 7
  239. },
  240. {
  241. "title": "than an object can be dropped",
  242. "cmd": [ "drop", "25ec10e6-c3d0-4363-a762-899dade7f93c" ]
  243. },
  244. {
  245. "special": "verify store object cnt",
  246. "comment": "and the object was dropped",
  247. "count": 6
  248. },
  249. {
  250. "title": "than an object can be dropped",
  251. "cmd": [ "drop", "89544934-6ed9-46ca-b8d0-77c5209f798d" ]
  252. },
  253. {
  254. "special": "verify store object cnt",
  255. "comment": "and the object was dropped",
  256. "count": 5
  257. }
  258. ]