persistence_spec_test.json 29 KB

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