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.
 
 
 
 

227 lines
8.9 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 tag",
  72. "cmd": [ "modify", "+dc:creator=Another user", "newfile.txt" ]
  73. },
  74. {
  75. "title": "another dc:creator tag is present",
  76. "cmd": [ "list", "newfile.txt" ],
  77. "stdout_re": "dc:creator:\tAnother user\ndc:creator:\tJohn-Mark Gurney\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  78. },
  79. {
  80. "title": "remove specific tag",
  81. "cmd": [ "modify", "-dc:creator=Another user", "newfile.txt" ]
  82. },
  83. {
  84. "title": "another dc:creator tag is present",
  85. "cmd": [ "list", "newfile.txt" ],
  86. "stdout_re": "dc:creator:\tJohn-Mark Gurney\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  87. },
  88. {
  89. "title": "remove all dc:creator tags",
  90. "cmd": [ "modify", "-dc:creator", "newfile.txt" ]
  91. },
  92. {
  93. "title": "that all dc:creator tags are removed",
  94. "cmd": [ "list", "newfile.txt" ],
  95. "stdout_re": "hashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  96. },
  97. {
  98. "title": "tag value w/ equals",
  99. "cmd": [ "modify", "+foo=bar=baz", "newfile.txt" ]
  100. },
  101. {
  102. "title": "print file",
  103. "cmd": [ "list", "newfile.txt" ],
  104. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  105. },
  106. {
  107. "title": "test file is not present",
  108. "cmd": [ "list", "test.txt" ],
  109. "exit": 1,
  110. "stderr": "ERROR: file not found: 'test.txt'\n"
  111. },
  112. {
  113. "special": "copy newfile.txt to test.txt"
  114. },
  115. {
  116. "title": "copied file now has same metadata",
  117. "cmd": [ "list", "test.txt" ],
  118. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  119. },
  120. {
  121. "special": "verify store object cnt",
  122. "comment": "should have two file and one metadata",
  123. "count": 3
  124. },
  125. {
  126. "special": "change newfile.txt"
  127. },
  128. {
  129. "title": "newfile file is now not present",
  130. "cmd": [ "list", "newfile.txt" ],
  131. "exit": 1,
  132. "stderr": "ERROR: file not found: 'newfile.txt'\n"
  133. },
  134. {
  135. "title": "old file still has same metadata",
  136. "cmd": [ "list", "test.txt" ],
  137. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  138. },
  139. {
  140. "special": "verify store object cnt",
  141. "comment": "should have two file and one metadata",
  142. "count": 3
  143. },
  144. {
  145. "title": "test.txt in subdir t has same metadata",
  146. "cmd": [ "list", "t/newfile.txt" ],
  147. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  148. },
  149. {
  150. "special": "verify store object cnt",
  151. "comment": "and a obj was created for subdir",
  152. "count": 4
  153. },
  154. {
  155. "title": "that two files can be tagged at once",
  156. "cmd": [ "modify", "+random=", "--", "t/newfile.txt", "test.txt" ]
  157. },
  158. {
  159. "title": "that two files can be un-tagged at once",
  160. "cmd": [ "modify", "-random=", "t/newfile.txt", "test.txt" ]
  161. },
  162. {
  163. "special": "set hostid",
  164. "comment": "and that a modified hostid",
  165. "hostid": "ceaa4862-dd00-41ba-9787-7480ec1b2679"
  166. },
  167. {
  168. "title": "test.txt in subdir t has same metadata",
  169. "cmd": [ "list", "t/newfile.txt" ],
  170. "stdout_re": "foo:\tbar=baz\nhashes:\tsha512:90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c\nsig:\t.*\ntag:\t\n"
  171. },
  172. {
  173. "special": "verify store object cnt",
  174. "comment": "and a obj was created for the new host",
  175. "count": 5
  176. },
  177. {
  178. "title": "a common tag is disallowed",
  179. "cmd": [ "modify", "+modified=foo", "test.txt" ],
  180. "exit": 1,
  181. "stderr": "ERROR: invalid tag: ['modified'].\n"
  182. },
  183. {
  184. "title": "must be a + or -",
  185. "cmd": [ "modify", "modified=foo", "test.txt" ],
  186. "exit": 1,
  187. "stderr": "ERROR: file not found: 'modified=foo', or invalid tag specification.\n"
  188. },
  189. {
  190. "special": "iter is unique"
  191. },
  192. {
  193. "title": "dump is correct",
  194. "cmd": [ "dump" ],
  195. "exit": 0,
  196. "stdout_re": "{.*filename.*newfile.txt.*hashes.*90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c.*size.*19.*type.*file.*}\n{.*foo.*bar=baz.*hashes.*90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c.*type.*metadata.*}\n{.*filename.*test.txt.*90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c.*size.*19.*type.*file.*}\n{.*filename.*newfile.txt.*90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c.*size.*19.*type.*file.*}\n{.*filename.*newfile.txt.*90f8342520f0ac57fb5a779f5d331c2fa87aa40f8799940257f9ba619940951e67143a8d746535ed0284924b2b7bc1478f095198800ba96d01847d7b56ca465c.*size.*19.*type.*file.*}\n"
  197. },
  198. {
  199. "title": "that import can be done",
  200. "cmd": [ "import" ],
  201. "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"
  202. },
  203. {
  204. "special": "verify store object cnt",
  205. "comment": "and the objects were imported",
  206. "count": 7
  207. },
  208. {
  209. "title": "than an object can be dropped",
  210. "cmd": [ "drop", "25ec10e6-c3d0-4363-a762-899dade7f93c" ]
  211. },
  212. {
  213. "special": "verify store object cnt",
  214. "comment": "and the object was dropped",
  215. "count": 6
  216. },
  217. {
  218. "title": "than an object can be dropped",
  219. "cmd": [ "drop", "89544934-6ed9-46ca-b8d0-77c5209f798d" ]
  220. },
  221. {
  222. "special": "verify store object cnt",
  223. "comment": "and the object was dropped",
  224. "count": 5
  225. }
  226. ]