offline_spec_test.json 31 KB

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