resume_token_spec_test.json 6.4 KB

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