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.
 
 
 
 

191 lines
4.5 KiB

  1. [
  2. {
  3. "title": "gen ident",
  4. "cmd": [ "genident", "name=A Test User" ],
  5. "exit": 0
  6. },
  7. {
  8. "special": "set hostid",
  9. "hostid": "ceaa4862-dd00-41ba-9787-7480ec1b2679"
  10. },
  11. {
  12. "title": "create host",
  13. "cmd": [ "hosts" ]
  14. },
  15. {
  16. "special": "set hostid",
  17. "hostid": "efdb5d9c-d123-4b30-aaa8-45a9ea8f6053"
  18. },
  19. {
  20. "title": "create host",
  21. "cmd": [ "hosts" ]
  22. },
  23. {
  24. "title": "search --help works",
  25. "cmd": [ "search", "--help" ],
  26. "stdout_re": "^usage:.*"
  27. },
  28. {
  29. "title": "search --unkonwn errors with usage",
  30. "cmd": [ "search", "--unkown" ],
  31. "exit": 1,
  32. "stderr_re": "^Unknown option: --unkown\nusage:.*"
  33. },
  34. {
  35. "title": "add tag a",
  36. "cmd": [ "modify", "+tag=foo", "+dc:creator=John-Mark Gurney", "newfile.txt" ]
  37. },
  38. {
  39. "special": "store now"
  40. },
  41. {
  42. "title": "add tag b",
  43. "cmd": [ "modify", "+tag=bar", "+dc:creator=John-Mark Gurney", "+other=baz", "test.txt" ]
  44. },
  45. {
  46. "special": "verify store object cnt",
  47. "comment": "should have two file and two metadata and two hosts",
  48. "count": 6
  49. },
  50. {
  51. "title": "invalid meta:",
  52. "cmd": [ "search", "file", "+meta:modified" ],
  53. "stderr": "invalid meta: specification: 'meta:modified'\n",
  54. "exit": 1
  55. },
  56. {
  57. "special": "format next cmd"
  58. },
  59. {
  60. "title": "search on meta:modified",
  61. "cmd": [ "search", "file", "+meta:modified>{nowiso}" ],
  62. "stdout_re": "/test.txt\n$"
  63. },
  64. {
  65. "special": "format next cmd"
  66. },
  67. {
  68. "title": "search on meta:modified",
  69. "cmd": [ "search", "file", "+meta:modified<{nowiso}" ],
  70. "stdout_re": "/newfile.txt\n$"
  71. },
  72. {
  73. "title": "search tag bar",
  74. "cmd": [ "search", "file", "+tag=bar" ],
  75. "stdout_re": "/test.txt\n$"
  76. },
  77. {
  78. "title": "search no tag bar",
  79. "cmd": [ "search", "file", "-tag=bar" ],
  80. "stdout_re": "/newfile.txt\n$"
  81. },
  82. {
  83. "title": "search no other",
  84. "cmd": [ "search", "file", "-other" ],
  85. "stdout_re": "/newfile.txt\n$"
  86. },
  87. {
  88. "title": "add tag c",
  89. "cmd": [ "modify", "+bleh=baz", "newfile.txt" ]
  90. },
  91. {
  92. "title": "add tag d",
  93. "cmd": [ "modify", "+tag=bar", "newfile.txt" ]
  94. },
  95. {
  96. "special": "set hostid",
  97. "hostid": "ceaa4862-dd00-41ba-9787-7480ec1b2679"
  98. },
  99. {
  100. "title": "test that no mapping works",
  101. "cmd": [ "search", "file", "+other" ],
  102. "stdout_re": "^efdb5d9c-d123-4b30-aaa8-45a9ea8f6053:/.*/test.txt\n$"
  103. },
  104. {
  105. "special": "set hostid",
  106. "hostid": "efdb5d9c-d123-4b30-aaa8-45a9ea8f6053"
  107. },
  108. {
  109. "title": "host mapping works",
  110. "cmd": [ "mapping", "--create", ".", "ceaa4862-dd00-41ba-9787-7480ec1b2679:/foobar" ]
  111. },
  112. {
  113. "special": "set hostid",
  114. "hostid": "ceaa4862-dd00-41ba-9787-7480ec1b2679"
  115. },
  116. {
  117. "title": "search other, mapped properly",
  118. "cmd": [ "search", "file", "+other" ],
  119. "stdout_re": "^/foobar/test.txt\n$"
  120. },
  121. {
  122. "title": "search other, mapped properly",
  123. "cmd": [ "search", "file" ],
  124. "stdout": "/foobar/newfile.txt\n/foobar/test.txt\n"
  125. },
  126. {
  127. "title": "add tag with space",
  128. "cmd": [ "modify", "+tag=car baz", "test.txt" ]
  129. },
  130. {
  131. "title": "search tags",
  132. "cmd": [ "search", "tags", "tag" ],
  133. "stdout": "tag=bar\ntag=car baz\ntag=foo\n"
  134. },
  135. {
  136. "title": "search bogus",
  137. "cmd": [ "search", "lskdjflaskjdoijef", "tag" ],
  138. "exit": 1,
  139. "stderr": "unknown search type: 'lskdjflaskjdoijef'\n"
  140. },
  141. {
  142. "title": "search exclusion properly",
  143. "cmd": [ "search", "file", "-tag" ],
  144. "stdout": ""
  145. },
  146. {
  147. "title": "search exclusion w/ inclusion properly",
  148. "cmd": [ "search", "file", "+tag=bar", "-other" ],
  149. "stdout": "/foobar/newfile.txt\n"
  150. },
  151. {
  152. "title": "create a file with space in it",
  153. "special": "create file",
  154. "file": "file name space.txt",
  155. "contents": "a file name with space in it.\n"
  156. },
  157. {
  158. "title": "create a file with newline in it",
  159. "special": "create file",
  160. "file": "new\nline'.txt",
  161. "contents": "a file name with new line in it.\n"
  162. },
  163. {
  164. "title": "create another file with newline in it",
  165. "special": "create file",
  166. "file": "another\nnew\nline\".txt",
  167. "contents": "another file name with new line in it.\n"
  168. },
  169. {
  170. "title": "create yet another file with newline in it",
  171. "special": "create file",
  172. "file": "yet another\nnew\nline\".txt",
  173. "contents": "yet file name with new line in it.\n"
  174. },
  175. {
  176. "title": "add special tag",
  177. "cmd": [ "modify", "+special=tag", "file name space.txt", "new\nline'.txt", "another\nnew\nline\".txt", "yet another\nnew\nline\".txt" ]
  178. },
  179. {
  180. "title": "without any special args, it is skipped with one warning",
  181. "cmd": [ "search", "file", "+special=tag" ],
  182. "stdout_re": "^.*file name space.txt\n$",
  183. "stderr": "Warning: file with neline in name was skipped.\n"
  184. },
  185. {
  186. "title": "with --xargs arg",
  187. "cmd": [ "search", "--xargs", "file", "+special=tag" ],
  188. "stdout_re": "^'.*file name space.txt'\n.*new\\\\\n\"line'.txt\"\n.*another\\\\\nnew\\\\\n'line\".txt'\n'.*yet another'\\\\\nnew\\\\\n'line\".txt'\n$"
  189. }
  190. ]