resume_token_spec_test.json 7.0 KB

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