offline_spec_test.json 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393
  1. {
  2. "A successful message delays offline status": {
  3. "describeName": "Offline:",
  4. "itName": "A successful message delays offline status",
  5. "tags": [
  6. ],
  7. "config": {
  8. "numClients": 1,
  9. "useGarbageCollection": true
  10. },
  11. "steps": [
  12. {
  13. "userListen": [
  14. 2,
  15. {
  16. "filters": [
  17. ],
  18. "orderBys": [
  19. ],
  20. "path": "collection"
  21. }
  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. "watchStreamClose": {
  47. "error": {
  48. "code": 14,
  49. "message": "Simulated Backend Error"
  50. },
  51. "runBackoffTimer": true
  52. }
  53. },
  54. {
  55. "watchStreamClose": {
  56. "error": {
  57. "code": 14,
  58. "message": "Simulated Backend Error"
  59. },
  60. "runBackoffTimer": true
  61. },
  62. "expectedSnapshotEvents": [
  63. {
  64. "errorCode": 0,
  65. "fromCache": true,
  66. "hasPendingWrites": false,
  67. "query": {
  68. "filters": [
  69. ],
  70. "orderBys": [
  71. ],
  72. "path": "collection"
  73. }
  74. }
  75. ]
  76. },
  77. {
  78. "watchStreamClose": {
  79. "error": {
  80. "code": 14,
  81. "message": "Simulated Backend Error"
  82. },
  83. "runBackoffTimer": true
  84. }
  85. },
  86. {
  87. "watchStreamClose": {
  88. "error": {
  89. "code": 14,
  90. "message": "Simulated Backend Error"
  91. },
  92. "runBackoffTimer": true
  93. }
  94. }
  95. ]
  96. },
  97. "Empty queries are resolved if client goes offline": {
  98. "describeName": "Offline:",
  99. "itName": "Empty queries are resolved if client goes offline",
  100. "tags": [
  101. ],
  102. "config": {
  103. "numClients": 1,
  104. "useGarbageCollection": true
  105. },
  106. "steps": [
  107. {
  108. "userListen": [
  109. 2,
  110. {
  111. "filters": [
  112. ],
  113. "orderBys": [
  114. ],
  115. "path": "collection"
  116. }
  117. ],
  118. "expectedState": {
  119. "activeTargets": {
  120. "2": {
  121. "queries": [
  122. {
  123. "filters": [
  124. ],
  125. "orderBys": [
  126. ],
  127. "path": "collection"
  128. }
  129. ],
  130. "resumeToken": ""
  131. }
  132. }
  133. }
  134. },
  135. {
  136. "watchStreamClose": {
  137. "error": {
  138. "code": 14,
  139. "message": "Simulated Backend Error"
  140. },
  141. "runBackoffTimer": true
  142. },
  143. "expectedSnapshotEvents": [
  144. {
  145. "errorCode": 0,
  146. "fromCache": true,
  147. "hasPendingWrites": false,
  148. "query": {
  149. "filters": [
  150. ],
  151. "orderBys": [
  152. ],
  153. "path": "collection"
  154. }
  155. }
  156. ]
  157. },
  158. {
  159. "watchStreamClose": {
  160. "error": {
  161. "code": 14,
  162. "message": "Simulated Backend Error"
  163. },
  164. "runBackoffTimer": true
  165. }
  166. },
  167. {
  168. "watchStreamClose": {
  169. "error": {
  170. "code": 14,
  171. "message": "Simulated Backend Error"
  172. },
  173. "runBackoffTimer": true
  174. }
  175. }
  176. ]
  177. },
  178. "New queries return immediately with fromCache=true when offline due to OnlineState timeout.": {
  179. "describeName": "Offline:",
  180. "itName": "New queries return immediately with fromCache=true when offline due to OnlineState timeout.",
  181. "tags": [
  182. ],
  183. "config": {
  184. "numClients": 1,
  185. "useGarbageCollection": true
  186. },
  187. "steps": [
  188. {
  189. "userListen": [
  190. 2,
  191. {
  192. "filters": [
  193. ],
  194. "orderBys": [
  195. ],
  196. "path": "collection"
  197. }
  198. ],
  199. "expectedState": {
  200. "activeTargets": {
  201. "2": {
  202. "queries": [
  203. {
  204. "filters": [
  205. ],
  206. "orderBys": [
  207. ],
  208. "path": "collection"
  209. }
  210. ],
  211. "resumeToken": ""
  212. }
  213. }
  214. }
  215. },
  216. {
  217. "runTimer": "online_state_timeout",
  218. "expectedSnapshotEvents": [
  219. {
  220. "errorCode": 0,
  221. "fromCache": true,
  222. "hasPendingWrites": false,
  223. "query": {
  224. "filters": [
  225. ],
  226. "orderBys": [
  227. ],
  228. "path": "collection"
  229. }
  230. }
  231. ]
  232. },
  233. {
  234. "userListen": [
  235. 4,
  236. {
  237. "filters": [
  238. ],
  239. "orderBys": [
  240. ],
  241. "path": "collection2"
  242. }
  243. ],
  244. "expectedSnapshotEvents": [
  245. {
  246. "errorCode": 0,
  247. "fromCache": true,
  248. "hasPendingWrites": false,
  249. "query": {
  250. "filters": [
  251. ],
  252. "orderBys": [
  253. ],
  254. "path": "collection2"
  255. }
  256. }
  257. ],
  258. "expectedState": {
  259. "activeTargets": {
  260. "2": {
  261. "queries": [
  262. {
  263. "filters": [
  264. ],
  265. "orderBys": [
  266. ],
  267. "path": "collection"
  268. }
  269. ],
  270. "resumeToken": ""
  271. },
  272. "4": {
  273. "queries": [
  274. {
  275. "filters": [
  276. ],
  277. "orderBys": [
  278. ],
  279. "path": "collection2"
  280. }
  281. ],
  282. "resumeToken": ""
  283. }
  284. }
  285. }
  286. }
  287. ]
  288. },
  289. "New queries return immediately with fromCache=true when offline due to stream failures.": {
  290. "describeName": "Offline:",
  291. "itName": "New queries return immediately with fromCache=true when offline due to stream failures.",
  292. "tags": [
  293. ],
  294. "config": {
  295. "numClients": 1,
  296. "useGarbageCollection": true
  297. },
  298. "steps": [
  299. {
  300. "userListen": [
  301. 2,
  302. {
  303. "filters": [
  304. ],
  305. "orderBys": [
  306. ],
  307. "path": "collection"
  308. }
  309. ],
  310. "expectedState": {
  311. "activeTargets": {
  312. "2": {
  313. "queries": [
  314. {
  315. "filters": [
  316. ],
  317. "orderBys": [
  318. ],
  319. "path": "collection"
  320. }
  321. ],
  322. "resumeToken": ""
  323. }
  324. }
  325. }
  326. },
  327. {
  328. "watchStreamClose": {
  329. "error": {
  330. "code": 14,
  331. "message": "Simulated Backend Error"
  332. },
  333. "runBackoffTimer": true
  334. },
  335. "expectedSnapshotEvents": [
  336. {
  337. "errorCode": 0,
  338. "fromCache": true,
  339. "hasPendingWrites": false,
  340. "query": {
  341. "filters": [
  342. ],
  343. "orderBys": [
  344. ],
  345. "path": "collection"
  346. }
  347. }
  348. ]
  349. },
  350. {
  351. "userListen": [
  352. 4,
  353. {
  354. "filters": [
  355. ],
  356. "orderBys": [
  357. ],
  358. "path": "collection2"
  359. }
  360. ],
  361. "expectedSnapshotEvents": [
  362. {
  363. "errorCode": 0,
  364. "fromCache": true,
  365. "hasPendingWrites": false,
  366. "query": {
  367. "filters": [
  368. ],
  369. "orderBys": [
  370. ],
  371. "path": "collection2"
  372. }
  373. }
  374. ],
  375. "expectedState": {
  376. "activeTargets": {
  377. "2": {
  378. "queries": [
  379. {
  380. "filters": [
  381. ],
  382. "orderBys": [
  383. ],
  384. "path": "collection"
  385. }
  386. ],
  387. "resumeToken": ""
  388. },
  389. "4": {
  390. "queries": [
  391. {
  392. "filters": [
  393. ],
  394. "orderBys": [
  395. ],
  396. "path": "collection2"
  397. }
  398. ],
  399. "resumeToken": ""
  400. }
  401. }
  402. }
  403. }
  404. ]
  405. },
  406. "OnlineState timeout triggers offline behavior": {
  407. "describeName": "Offline:",
  408. "itName": "OnlineState timeout triggers offline behavior",
  409. "tags": [
  410. ],
  411. "config": {
  412. "numClients": 1,
  413. "useGarbageCollection": true
  414. },
  415. "steps": [
  416. {
  417. "userListen": [
  418. 2,
  419. {
  420. "filters": [
  421. ],
  422. "orderBys": [
  423. ],
  424. "path": "collection"
  425. }
  426. ],
  427. "expectedState": {
  428. "activeTargets": {
  429. "2": {
  430. "queries": [
  431. {
  432. "filters": [
  433. ],
  434. "orderBys": [
  435. ],
  436. "path": "collection"
  437. }
  438. ],
  439. "resumeToken": ""
  440. }
  441. }
  442. }
  443. },
  444. {
  445. "runTimer": "online_state_timeout",
  446. "expectedSnapshotEvents": [
  447. {
  448. "errorCode": 0,
  449. "fromCache": true,
  450. "hasPendingWrites": false,
  451. "query": {
  452. "filters": [
  453. ],
  454. "orderBys": [
  455. ],
  456. "path": "collection"
  457. }
  458. }
  459. ]
  460. },
  461. {
  462. "watchStreamClose": {
  463. "error": {
  464. "code": 14,
  465. "message": "Simulated Backend Error"
  466. },
  467. "runBackoffTimer": true
  468. }
  469. },
  470. {
  471. "watchStreamClose": {
  472. "error": {
  473. "code": 14,
  474. "message": "Simulated Backend Error"
  475. },
  476. "runBackoffTimer": true
  477. }
  478. },
  479. {
  480. "watchAck": [
  481. 2
  482. ]
  483. },
  484. {
  485. "watchEntity": {
  486. "docs": [
  487. {
  488. "key": "collection/a",
  489. "options": {
  490. "hasCommittedMutations": false,
  491. "hasLocalMutations": false
  492. },
  493. "value": {
  494. "key": "a"
  495. },
  496. "version": 1000
  497. }
  498. ],
  499. "targets": [
  500. 2
  501. ]
  502. }
  503. },
  504. {
  505. "watchCurrent": [
  506. [
  507. 2
  508. ],
  509. "resume-token-1000"
  510. ]
  511. },
  512. {
  513. "watchSnapshot": {
  514. "targetIds": [
  515. ],
  516. "version": 1000
  517. },
  518. "expectedSnapshotEvents": [
  519. {
  520. "added": [
  521. {
  522. "key": "collection/a",
  523. "options": {
  524. "hasCommittedMutations": false,
  525. "hasLocalMutations": false
  526. },
  527. "value": {
  528. "key": "a"
  529. },
  530. "version": 1000
  531. }
  532. ],
  533. "errorCode": 0,
  534. "fromCache": false,
  535. "hasPendingWrites": false,
  536. "query": {
  537. "filters": [
  538. ],
  539. "orderBys": [
  540. ],
  541. "path": "collection"
  542. }
  543. }
  544. ]
  545. },
  546. {
  547. "runTimer": "all"
  548. },
  549. {
  550. "watchStreamClose": {
  551. "error": {
  552. "code": 14,
  553. "message": "Simulated Backend Error"
  554. },
  555. "runBackoffTimer": true
  556. },
  557. "expectedState": {
  558. "activeTargets": {
  559. "2": {
  560. "queries": [
  561. {
  562. "filters": [
  563. ],
  564. "orderBys": [
  565. ],
  566. "path": "collection"
  567. }
  568. ],
  569. "resumeToken": "resume-token-1000"
  570. }
  571. }
  572. }
  573. },
  574. {
  575. "runTimer": "online_state_timeout",
  576. "expectedSnapshotEvents": [
  577. {
  578. "errorCode": 0,
  579. "fromCache": true,
  580. "hasPendingWrites": false,
  581. "query": {
  582. "filters": [
  583. ],
  584. "orderBys": [
  585. ],
  586. "path": "collection"
  587. }
  588. }
  589. ]
  590. }
  591. ]
  592. },
  593. "Queries return from cache when network disabled": {
  594. "describeName": "Offline:",
  595. "itName": "Queries return from cache when network disabled",
  596. "tags": [
  597. "eager-gc"
  598. ],
  599. "config": {
  600. "numClients": 1,
  601. "useGarbageCollection": true
  602. },
  603. "steps": [
  604. {
  605. "enableNetwork": false,
  606. "expectedState": {
  607. "activeLimboDocs": [
  608. ],
  609. "activeTargets": {
  610. },
  611. "enqueuedLimboDocs": [
  612. ]
  613. }
  614. },
  615. {
  616. "userListen": [
  617. 2,
  618. {
  619. "filters": [
  620. ],
  621. "orderBys": [
  622. ],
  623. "path": "collection"
  624. }
  625. ],
  626. "expectedSnapshotEvents": [
  627. {
  628. "errorCode": 0,
  629. "fromCache": true,
  630. "hasPendingWrites": false,
  631. "query": {
  632. "filters": [
  633. ],
  634. "orderBys": [
  635. ],
  636. "path": "collection"
  637. }
  638. }
  639. ],
  640. "expectedState": {
  641. "activeTargets": {
  642. "2": {
  643. "queries": [
  644. {
  645. "filters": [
  646. ],
  647. "orderBys": [
  648. ],
  649. "path": "collection"
  650. }
  651. ],
  652. "resumeToken": ""
  653. }
  654. }
  655. }
  656. },
  657. {
  658. "userUnlisten": [
  659. 2,
  660. {
  661. "filters": [
  662. ],
  663. "orderBys": [
  664. ],
  665. "path": "collection"
  666. }
  667. ],
  668. "expectedState": {
  669. "activeTargets": {
  670. }
  671. }
  672. },
  673. {
  674. "userListen": [
  675. 4,
  676. {
  677. "filters": [
  678. ],
  679. "orderBys": [
  680. ],
  681. "path": "collection"
  682. }
  683. ],
  684. "expectedSnapshotEvents": [
  685. {
  686. "errorCode": 0,
  687. "fromCache": true,
  688. "hasPendingWrites": false,
  689. "query": {
  690. "filters": [
  691. ],
  692. "orderBys": [
  693. ],
  694. "path": "collection"
  695. }
  696. }
  697. ],
  698. "expectedState": {
  699. "activeTargets": {
  700. "4": {
  701. "queries": [
  702. {
  703. "filters": [
  704. ],
  705. "orderBys": [
  706. ],
  707. "path": "collection"
  708. }
  709. ],
  710. "resumeToken": ""
  711. }
  712. }
  713. }
  714. },
  715. {
  716. "userUnlisten": [
  717. 4,
  718. {
  719. "filters": [
  720. ],
  721. "orderBys": [
  722. ],
  723. "path": "collection"
  724. }
  725. ],
  726. "expectedState": {
  727. "activeTargets": {
  728. }
  729. }
  730. }
  731. ]
  732. },
  733. "Queries revert to fromCache=true when offline.": {
  734. "describeName": "Offline:",
  735. "itName": "Queries revert to fromCache=true when offline.",
  736. "tags": [
  737. ],
  738. "config": {
  739. "numClients": 1,
  740. "useGarbageCollection": true
  741. },
  742. "steps": [
  743. {
  744. "userListen": [
  745. 2,
  746. {
  747. "filters": [
  748. ],
  749. "orderBys": [
  750. ],
  751. "path": "collection"
  752. }
  753. ],
  754. "expectedState": {
  755. "activeTargets": {
  756. "2": {
  757. "queries": [
  758. {
  759. "filters": [
  760. ],
  761. "orderBys": [
  762. ],
  763. "path": "collection"
  764. }
  765. ],
  766. "resumeToken": ""
  767. }
  768. }
  769. }
  770. },
  771. {
  772. "watchAck": [
  773. 2
  774. ]
  775. },
  776. {
  777. "watchEntity": {
  778. "docs": [
  779. {
  780. "key": "collection/a",
  781. "options": {
  782. "hasCommittedMutations": false,
  783. "hasLocalMutations": false
  784. },
  785. "value": {
  786. "key": "a"
  787. },
  788. "version": 1000
  789. }
  790. ],
  791. "targets": [
  792. 2
  793. ]
  794. }
  795. },
  796. {
  797. "watchCurrent": [
  798. [
  799. 2
  800. ],
  801. "resume-token-1000"
  802. ]
  803. },
  804. {
  805. "watchSnapshot": {
  806. "targetIds": [
  807. ],
  808. "version": 1000
  809. },
  810. "expectedSnapshotEvents": [
  811. {
  812. "added": [
  813. {
  814. "key": "collection/a",
  815. "options": {
  816. "hasCommittedMutations": false,
  817. "hasLocalMutations": false
  818. },
  819. "value": {
  820. "key": "a"
  821. },
  822. "version": 1000
  823. }
  824. ],
  825. "errorCode": 0,
  826. "fromCache": false,
  827. "hasPendingWrites": false,
  828. "query": {
  829. "filters": [
  830. ],
  831. "orderBys": [
  832. ],
  833. "path": "collection"
  834. }
  835. }
  836. ]
  837. },
  838. {
  839. "watchStreamClose": {
  840. "error": {
  841. "code": 14,
  842. "message": "Simulated Backend Error"
  843. },
  844. "runBackoffTimer": true
  845. },
  846. "expectedState": {
  847. "activeTargets": {
  848. "2": {
  849. "queries": [
  850. {
  851. "filters": [
  852. ],
  853. "orderBys": [
  854. ],
  855. "path": "collection"
  856. }
  857. ],
  858. "resumeToken": "resume-token-1000"
  859. }
  860. }
  861. }
  862. },
  863. {
  864. "watchStreamClose": {
  865. "error": {
  866. "code": 14,
  867. "message": "Simulated Backend Error"
  868. },
  869. "runBackoffTimer": true
  870. },
  871. "expectedSnapshotEvents": [
  872. {
  873. "errorCode": 0,
  874. "fromCache": true,
  875. "hasPendingWrites": false,
  876. "query": {
  877. "filters": [
  878. ],
  879. "orderBys": [
  880. ],
  881. "path": "collection"
  882. }
  883. }
  884. ]
  885. },
  886. {
  887. "watchAck": [
  888. 2
  889. ]
  890. },
  891. {
  892. "watchEntity": {
  893. "docs": [
  894. ],
  895. "targets": [
  896. 2
  897. ]
  898. }
  899. },
  900. {
  901. "watchCurrent": [
  902. [
  903. 2
  904. ],
  905. "resume-token-1000"
  906. ]
  907. },
  908. {
  909. "watchSnapshot": {
  910. "targetIds": [
  911. ],
  912. "version": 1000
  913. },
  914. "expectedSnapshotEvents": [
  915. {
  916. "errorCode": 0,
  917. "fromCache": false,
  918. "hasPendingWrites": false,
  919. "query": {
  920. "filters": [
  921. ],
  922. "orderBys": [
  923. ],
  924. "path": "collection"
  925. }
  926. }
  927. ]
  928. }
  929. ]
  930. },
  931. "Queries with limbo documents handle going offline.": {
  932. "describeName": "Offline:",
  933. "itName": "Queries with limbo documents handle going offline.",
  934. "tags": [
  935. ],
  936. "config": {
  937. "numClients": 1,
  938. "useGarbageCollection": true
  939. },
  940. "steps": [
  941. {
  942. "userListen": [
  943. 2,
  944. {
  945. "filters": [
  946. ],
  947. "orderBys": [
  948. ],
  949. "path": "collection"
  950. }
  951. ],
  952. "expectedState": {
  953. "activeTargets": {
  954. "2": {
  955. "queries": [
  956. {
  957. "filters": [
  958. ],
  959. "orderBys": [
  960. ],
  961. "path": "collection"
  962. }
  963. ],
  964. "resumeToken": ""
  965. }
  966. }
  967. }
  968. },
  969. {
  970. "watchAck": [
  971. 2
  972. ]
  973. },
  974. {
  975. "watchEntity": {
  976. "docs": [
  977. {
  978. "key": "collection/a",
  979. "options": {
  980. "hasCommittedMutations": false,
  981. "hasLocalMutations": false
  982. },
  983. "value": {
  984. "key": "a"
  985. },
  986. "version": 1000
  987. }
  988. ],
  989. "targets": [
  990. 2
  991. ]
  992. }
  993. },
  994. {
  995. "watchCurrent": [
  996. [
  997. 2
  998. ],
  999. "resume-token-1000"
  1000. ]
  1001. },
  1002. {
  1003. "watchSnapshot": {
  1004. "targetIds": [
  1005. ],
  1006. "version": 1000
  1007. },
  1008. "expectedSnapshotEvents": [
  1009. {
  1010. "added": [
  1011. {
  1012. "key": "collection/a",
  1013. "options": {
  1014. "hasCommittedMutations": false,
  1015. "hasLocalMutations": false
  1016. },
  1017. "value": {
  1018. "key": "a"
  1019. },
  1020. "version": 1000
  1021. }
  1022. ],
  1023. "errorCode": 0,
  1024. "fromCache": false,
  1025. "hasPendingWrites": false,
  1026. "query": {
  1027. "filters": [
  1028. ],
  1029. "orderBys": [
  1030. ],
  1031. "path": "collection"
  1032. }
  1033. }
  1034. ]
  1035. },
  1036. {
  1037. "watchReset": [
  1038. 2
  1039. ]
  1040. },
  1041. {
  1042. "watchCurrent": [
  1043. [
  1044. 2
  1045. ],
  1046. "resume-token-1001"
  1047. ]
  1048. },
  1049. {
  1050. "watchSnapshot": {
  1051. "targetIds": [
  1052. ],
  1053. "version": 1001
  1054. },
  1055. "expectedSnapshotEvents": [
  1056. {
  1057. "errorCode": 0,
  1058. "fromCache": true,
  1059. "hasPendingWrites": false,
  1060. "query": {
  1061. "filters": [
  1062. ],
  1063. "orderBys": [
  1064. ],
  1065. "path": "collection"
  1066. }
  1067. }
  1068. ],
  1069. "expectedState": {
  1070. "activeLimboDocs": [
  1071. "collection/a"
  1072. ],
  1073. "activeTargets": {
  1074. "1": {
  1075. "queries": [
  1076. {
  1077. "filters": [
  1078. ],
  1079. "orderBys": [
  1080. ],
  1081. "path": "collection/a"
  1082. }
  1083. ],
  1084. "resumeToken": ""
  1085. },
  1086. "2": {
  1087. "queries": [
  1088. {
  1089. "filters": [
  1090. ],
  1091. "orderBys": [
  1092. ],
  1093. "path": "collection"
  1094. }
  1095. ],
  1096. "resumeToken": ""
  1097. }
  1098. }
  1099. }
  1100. },
  1101. {
  1102. "watchStreamClose": {
  1103. "error": {
  1104. "code": 14,
  1105. "message": "Simulated Backend Error"
  1106. },
  1107. "runBackoffTimer": true
  1108. },
  1109. "expectedState": {
  1110. "activeTargets": {
  1111. "1": {
  1112. "queries": [
  1113. {
  1114. "filters": [
  1115. ],
  1116. "orderBys": [
  1117. ],
  1118. "path": "collection/a"
  1119. }
  1120. ],
  1121. "resumeToken": ""
  1122. },
  1123. "2": {
  1124. "queries": [
  1125. {
  1126. "filters": [
  1127. ],
  1128. "orderBys": [
  1129. ],
  1130. "path": "collection"
  1131. }
  1132. ],
  1133. "resumeToken": "resume-token-1001"
  1134. }
  1135. }
  1136. }
  1137. },
  1138. {
  1139. "watchStreamClose": {
  1140. "error": {
  1141. "code": 14,
  1142. "message": "Simulated Backend Error"
  1143. },
  1144. "runBackoffTimer": true
  1145. }
  1146. },
  1147. {
  1148. "watchAck": [
  1149. 2
  1150. ]
  1151. },
  1152. {
  1153. "watchEntity": {
  1154. "docs": [
  1155. ],
  1156. "targets": [
  1157. 2
  1158. ]
  1159. }
  1160. },
  1161. {
  1162. "watchCurrent": [
  1163. [
  1164. 2
  1165. ],
  1166. "resume-token-1001"
  1167. ]
  1168. },
  1169. {
  1170. "watchSnapshot": {
  1171. "targetIds": [
  1172. ],
  1173. "version": 1001
  1174. }
  1175. },
  1176. {
  1177. "watchAck": [
  1178. 1
  1179. ]
  1180. },
  1181. {
  1182. "watchEntity": {
  1183. "docs": [
  1184. ],
  1185. "targets": [
  1186. 1
  1187. ]
  1188. }
  1189. },
  1190. {
  1191. "watchCurrent": [
  1192. [
  1193. 1
  1194. ],
  1195. "resume-token-1001"
  1196. ]
  1197. },
  1198. {
  1199. "watchSnapshot": {
  1200. "targetIds": [
  1201. ],
  1202. "version": 1001
  1203. },
  1204. "expectedSnapshotEvents": [
  1205. {
  1206. "errorCode": 0,
  1207. "fromCache": false,
  1208. "hasPendingWrites": false,
  1209. "query": {
  1210. "filters": [
  1211. ],
  1212. "orderBys": [
  1213. ],
  1214. "path": "collection"
  1215. },
  1216. "removed": [
  1217. {
  1218. "key": "collection/a",
  1219. "options": {
  1220. "hasCommittedMutations": false,
  1221. "hasLocalMutations": false
  1222. },
  1223. "value": {
  1224. "key": "a"
  1225. },
  1226. "version": 1000
  1227. }
  1228. ]
  1229. }
  1230. ],
  1231. "expectedState": {
  1232. "activeLimboDocs": [
  1233. ],
  1234. "activeTargets": {
  1235. "2": {
  1236. "queries": [
  1237. {
  1238. "filters": [
  1239. ],
  1240. "orderBys": [
  1241. ],
  1242. "path": "collection"
  1243. }
  1244. ],
  1245. "resumeToken": "resume-token-1001"
  1246. }
  1247. }
  1248. }
  1249. }
  1250. ]
  1251. },
  1252. "Removing all listeners delays \"Offline\" status on next listen": {
  1253. "comment": "Marked as no-lru because when a listen is re-added, it gets a new target id rather than reusing one",
  1254. "describeName": "Offline:",
  1255. "itName": "Removing all listeners delays \"Offline\" status on next listen",
  1256. "tags": [
  1257. "eager-gc"
  1258. ],
  1259. "config": {
  1260. "numClients": 1,
  1261. "useGarbageCollection": true
  1262. },
  1263. "steps": [
  1264. {
  1265. "userListen": [
  1266. 2,
  1267. {
  1268. "filters": [
  1269. ],
  1270. "orderBys": [
  1271. ],
  1272. "path": "collection"
  1273. }
  1274. ],
  1275. "expectedState": {
  1276. "activeTargets": {
  1277. "2": {
  1278. "queries": [
  1279. {
  1280. "filters": [
  1281. ],
  1282. "orderBys": [
  1283. ],
  1284. "path": "collection"
  1285. }
  1286. ],
  1287. "resumeToken": ""
  1288. }
  1289. }
  1290. }
  1291. },
  1292. {
  1293. "watchStreamClose": {
  1294. "error": {
  1295. "code": 14,
  1296. "message": "Simulated Backend Error"
  1297. },
  1298. "runBackoffTimer": true
  1299. },
  1300. "expectedSnapshotEvents": [
  1301. {
  1302. "errorCode": 0,
  1303. "fromCache": true,
  1304. "hasPendingWrites": false,
  1305. "query": {
  1306. "filters": [
  1307. ],
  1308. "orderBys": [
  1309. ],
  1310. "path": "collection"
  1311. }
  1312. }
  1313. ]
  1314. },
  1315. {
  1316. "userUnlisten": [
  1317. 2,
  1318. {
  1319. "filters": [
  1320. ],
  1321. "orderBys": [
  1322. ],
  1323. "path": "collection"
  1324. }
  1325. ],
  1326. "expectedState": {
  1327. "activeTargets": {
  1328. }
  1329. }
  1330. },
  1331. {
  1332. "watchStreamClose": {
  1333. "error": {
  1334. "code": 14,
  1335. "message": "Simulated Backend Error"
  1336. },
  1337. "runBackoffTimer": true
  1338. }
  1339. },
  1340. {
  1341. "userListen": [
  1342. 4,
  1343. {
  1344. "filters": [
  1345. ],
  1346. "orderBys": [
  1347. ],
  1348. "path": "collection"
  1349. }
  1350. ],
  1351. "expectedState": {
  1352. "activeTargets": {
  1353. "4": {
  1354. "queries": [
  1355. {
  1356. "filters": [
  1357. ],
  1358. "orderBys": [
  1359. ],
  1360. "path": "collection"
  1361. }
  1362. ],
  1363. "resumeToken": ""
  1364. }
  1365. }
  1366. }
  1367. },
  1368. {
  1369. "watchStreamClose": {
  1370. "error": {
  1371. "code": 14,
  1372. "message": "Simulated Backend Error"
  1373. },
  1374. "runBackoffTimer": true
  1375. },
  1376. "expectedSnapshotEvents": [
  1377. {
  1378. "errorCode": 0,
  1379. "fromCache": true,
  1380. "hasPendingWrites": false,
  1381. "query": {
  1382. "filters": [
  1383. ],
  1384. "orderBys": [
  1385. ],
  1386. "path": "collection"
  1387. }
  1388. }
  1389. ]
  1390. }
  1391. ]
  1392. }
  1393. }