resume_token_spec_test.json 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. {
  2. "Resume tokens are sent after watch stream restarts": {
  3. "describeName": "Resume tokens:",
  4. "itName": "Resume tokens are sent after watch stream restarts",
  5. "tags": [
  6. ],
  7. "config": {
  8. "numClients": 1,
  9. "useGarbageCollection": true
  10. },
  11. "steps": [
  12. {
  13. "userListen": {
  14. "query": {
  15. "filters": [
  16. ],
  17. "orderBys": [
  18. ],
  19. "path": "collection"
  20. },
  21. "targetId": 2
  22. },
  23. "expectedState": {
  24. "activeTargets": {
  25. "2": {
  26. "queries": [
  27. {
  28. "filters": [
  29. ],
  30. "orderBys": [
  31. ],
  32. "path": "collection"
  33. }
  34. ],
  35. "resumeToken": ""
  36. }
  37. }
  38. }
  39. },
  40. {
  41. "watchAck": [
  42. 2
  43. ]
  44. },
  45. {
  46. "watchEntity": {
  47. "docs": [
  48. {
  49. "key": "collection/a",
  50. "options": {
  51. "hasCommittedMutations": false,
  52. "hasLocalMutations": false
  53. },
  54. "value": {
  55. "key": "a"
  56. },
  57. "version": 1000
  58. }
  59. ],
  60. "targets": [
  61. 2
  62. ]
  63. }
  64. },
  65. {
  66. "watchCurrent": [
  67. [
  68. 2
  69. ],
  70. "custom-query-resume-token"
  71. ]
  72. },
  73. {
  74. "watchSnapshot": {
  75. "targetIds": [
  76. ],
  77. "version": 1000
  78. },
  79. "expectedSnapshotEvents": [
  80. {
  81. "added": [
  82. {
  83. "key": "collection/a",
  84. "options": {
  85. "hasCommittedMutations": false,
  86. "hasLocalMutations": false
  87. },
  88. "value": {
  89. "key": "a"
  90. },
  91. "version": 1000
  92. }
  93. ],
  94. "errorCode": 0,
  95. "fromCache": false,
  96. "hasPendingWrites": false,
  97. "query": {
  98. "filters": [
  99. ],
  100. "orderBys": [
  101. ],
  102. "path": "collection"
  103. }
  104. }
  105. ]
  106. },
  107. {
  108. "watchStreamClose": {
  109. "error": {
  110. "code": 14,
  111. "message": "Simulated Backend Error"
  112. },
  113. "runBackoffTimer": true
  114. },
  115. "expectedState": {
  116. "activeTargets": {
  117. "2": {
  118. "queries": [
  119. {
  120. "filters": [
  121. ],
  122. "orderBys": [
  123. ],
  124. "path": "collection"
  125. }
  126. ],
  127. "resumeToken": "custom-query-resume-token"
  128. }
  129. }
  130. }
  131. }
  132. ]
  133. },
  134. "Resume tokens are used across new listens": {
  135. "describeName": "Resume tokens:",
  136. "itName": "Resume tokens are used across new listens",
  137. "tags": [
  138. ],
  139. "config": {
  140. "numClients": 1,
  141. "useGarbageCollection": false
  142. },
  143. "steps": [
  144. {
  145. "userListen": {
  146. "query": {
  147. "filters": [
  148. ],
  149. "orderBys": [
  150. ],
  151. "path": "collection"
  152. },
  153. "targetId": 2
  154. },
  155. "expectedState": {
  156. "activeTargets": {
  157. "2": {
  158. "queries": [
  159. {
  160. "filters": [
  161. ],
  162. "orderBys": [
  163. ],
  164. "path": "collection"
  165. }
  166. ],
  167. "resumeToken": ""
  168. }
  169. }
  170. }
  171. },
  172. {
  173. "watchAck": [
  174. 2
  175. ]
  176. },
  177. {
  178. "watchEntity": {
  179. "docs": [
  180. {
  181. "key": "collection/a",
  182. "options": {
  183. "hasCommittedMutations": false,
  184. "hasLocalMutations": false
  185. },
  186. "value": {
  187. "key": "a"
  188. },
  189. "version": 1000
  190. }
  191. ],
  192. "targets": [
  193. 2
  194. ]
  195. }
  196. },
  197. {
  198. "watchCurrent": [
  199. [
  200. 2
  201. ],
  202. "custom-query-resume-token"
  203. ]
  204. },
  205. {
  206. "watchSnapshot": {
  207. "targetIds": [
  208. ],
  209. "version": 1000
  210. },
  211. "expectedSnapshotEvents": [
  212. {
  213. "added": [
  214. {
  215. "key": "collection/a",
  216. "options": {
  217. "hasCommittedMutations": false,
  218. "hasLocalMutations": false
  219. },
  220. "value": {
  221. "key": "a"
  222. },
  223. "version": 1000
  224. }
  225. ],
  226. "errorCode": 0,
  227. "fromCache": false,
  228. "hasPendingWrites": false,
  229. "query": {
  230. "filters": [
  231. ],
  232. "orderBys": [
  233. ],
  234. "path": "collection"
  235. }
  236. }
  237. ]
  238. },
  239. {
  240. "userUnlisten": [
  241. 2,
  242. {
  243. "filters": [
  244. ],
  245. "orderBys": [
  246. ],
  247. "path": "collection"
  248. }
  249. ],
  250. "expectedState": {
  251. "activeTargets": {
  252. }
  253. }
  254. },
  255. {
  256. "userListen": {
  257. "query": {
  258. "filters": [
  259. ],
  260. "orderBys": [
  261. ],
  262. "path": "collection"
  263. },
  264. "targetId": 2
  265. },
  266. "expectedSnapshotEvents": [
  267. {
  268. "added": [
  269. {
  270. "key": "collection/a",
  271. "options": {
  272. "hasCommittedMutations": false,
  273. "hasLocalMutations": false
  274. },
  275. "value": {
  276. "key": "a"
  277. },
  278. "version": 1000
  279. }
  280. ],
  281. "errorCode": 0,
  282. "fromCache": true,
  283. "hasPendingWrites": false,
  284. "query": {
  285. "filters": [
  286. ],
  287. "orderBys": [
  288. ],
  289. "path": "collection"
  290. }
  291. }
  292. ],
  293. "expectedState": {
  294. "activeTargets": {
  295. "2": {
  296. "queries": [
  297. {
  298. "filters": [
  299. ],
  300. "orderBys": [
  301. ],
  302. "path": "collection"
  303. }
  304. ],
  305. "resumeToken": "custom-query-resume-token"
  306. }
  307. }
  308. }
  309. },
  310. {
  311. "watchAck": [
  312. 2
  313. ]
  314. },
  315. {
  316. "watchSnapshot": {
  317. "targetIds": [
  318. ],
  319. "version": 1001
  320. }
  321. }
  322. ]
  323. }
  324. }