persistence_spec_test.json 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439
  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. "useEagerGCForMemory": 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. "useEagerGCForMemory": 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. "useEagerGCForMemory": 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. "useEagerGCForMemory": 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. "useEagerGCForMemory": 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. "useEagerGCForMemory": 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. "createTime": 0,
  425. "key": "collection/key1",
  426. "options": {
  427. "hasCommittedMutations": false,
  428. "hasLocalMutations": true
  429. },
  430. "value": {
  431. "foo": "bar"
  432. },
  433. "version": 0
  434. },
  435. {
  436. "createTime": 0,
  437. "key": "collection/key2",
  438. "options": {
  439. "hasCommittedMutations": false,
  440. "hasLocalMutations": true
  441. },
  442. "value": {
  443. "baz": "quu"
  444. },
  445. "version": 0
  446. }
  447. ],
  448. "errorCode": 0,
  449. "fromCache": true,
  450. "hasPendingWrites": true,
  451. "query": {
  452. "filters": [
  453. ],
  454. "orderBys": [
  455. ],
  456. "path": "collection"
  457. }
  458. }
  459. ],
  460. "expectedState": {
  461. "activeTargets": {
  462. "2": {
  463. "queries": [
  464. {
  465. "filters": [
  466. ],
  467. "orderBys": [
  468. ],
  469. "path": "collection"
  470. }
  471. ],
  472. "resumeToken": ""
  473. }
  474. }
  475. }
  476. }
  477. ]
  478. },
  479. "Primary lease bound to network state": {
  480. "describeName": "Persistence:",
  481. "itName": "Primary lease bound to network state",
  482. "tags": [
  483. "multi-client"
  484. ],
  485. "config": {
  486. "numClients": 2,
  487. "useEagerGCForMemory": false
  488. },
  489. "steps": [
  490. {
  491. "clientIndex": 0,
  492. "drainQueue": true,
  493. "expectedState": {
  494. "isPrimary": true
  495. }
  496. },
  497. {
  498. "clientIndex": 0,
  499. "enableNetwork": false,
  500. "expectedState": {
  501. "activeLimboDocs": [
  502. ],
  503. "activeTargets": {
  504. },
  505. "enqueuedLimboDocs": [
  506. ],
  507. "isPrimary": true
  508. }
  509. },
  510. {
  511. "clientIndex": 1,
  512. "drainQueue": true,
  513. "expectedState": {
  514. "isPrimary": false
  515. }
  516. },
  517. {
  518. "clientIndex": 0,
  519. "drainQueue": true
  520. },
  521. {
  522. "clientIndex": 0,
  523. "runTimer": "client_metadata_refresh",
  524. "expectedState": {
  525. "isPrimary": false
  526. }
  527. },
  528. {
  529. "clientIndex": 1,
  530. "drainQueue": true
  531. },
  532. {
  533. "clientIndex": 1,
  534. "runTimer": "client_metadata_refresh",
  535. "expectedState": {
  536. "isPrimary": true
  537. }
  538. },
  539. {
  540. "clientIndex": 1,
  541. "enableNetwork": false,
  542. "expectedState": {
  543. "activeLimboDocs": [
  544. ],
  545. "activeTargets": {
  546. },
  547. "enqueuedLimboDocs": [
  548. ],
  549. "isPrimary": true
  550. }
  551. },
  552. {
  553. "clientIndex": 0,
  554. "drainQueue": true
  555. },
  556. {
  557. "clientIndex": 0,
  558. "enableNetwork": true,
  559. "expectedState": {
  560. "isPrimary": false
  561. }
  562. },
  563. {
  564. "clientIndex": 1,
  565. "drainQueue": true
  566. },
  567. {
  568. "clientIndex": 1,
  569. "runTimer": "client_metadata_refresh",
  570. "expectedState": {
  571. "isPrimary": false
  572. }
  573. },
  574. {
  575. "clientIndex": 0,
  576. "drainQueue": true
  577. },
  578. {
  579. "clientIndex": 0,
  580. "runTimer": "client_metadata_refresh",
  581. "expectedState": {
  582. "isPrimary": true
  583. }
  584. }
  585. ]
  586. },
  587. "Remote documents are persisted": {
  588. "describeName": "Persistence:",
  589. "itName": "Remote documents are persisted",
  590. "tags": [
  591. "durable-persistence"
  592. ],
  593. "config": {
  594. "numClients": 1,
  595. "useEagerGCForMemory": true
  596. },
  597. "steps": [
  598. {
  599. "userListen": {
  600. "query": {
  601. "filters": [
  602. ],
  603. "orderBys": [
  604. ],
  605. "path": "collection"
  606. },
  607. "targetId": 2
  608. },
  609. "expectedState": {
  610. "activeTargets": {
  611. "2": {
  612. "queries": [
  613. {
  614. "filters": [
  615. ],
  616. "orderBys": [
  617. ],
  618. "path": "collection"
  619. }
  620. ],
  621. "resumeToken": ""
  622. }
  623. }
  624. }
  625. },
  626. {
  627. "watchAck": [
  628. 2
  629. ]
  630. },
  631. {
  632. "watchEntity": {
  633. "docs": [
  634. {
  635. "createTime": 0,
  636. "key": "collection/key",
  637. "options": {
  638. "hasCommittedMutations": false,
  639. "hasLocalMutations": false
  640. },
  641. "value": {
  642. "foo": "bar"
  643. },
  644. "version": 1000
  645. }
  646. ],
  647. "targets": [
  648. 2
  649. ]
  650. }
  651. },
  652. {
  653. "watchCurrent": [
  654. [
  655. 2
  656. ],
  657. "resume-token-1000"
  658. ]
  659. },
  660. {
  661. "watchSnapshot": {
  662. "targetIds": [
  663. ],
  664. "version": 1000
  665. },
  666. "expectedSnapshotEvents": [
  667. {
  668. "added": [
  669. {
  670. "createTime": 0,
  671. "key": "collection/key",
  672. "options": {
  673. "hasCommittedMutations": false,
  674. "hasLocalMutations": false
  675. },
  676. "value": {
  677. "foo": "bar"
  678. },
  679. "version": 1000
  680. }
  681. ],
  682. "errorCode": 0,
  683. "fromCache": false,
  684. "hasPendingWrites": false,
  685. "query": {
  686. "filters": [
  687. ],
  688. "orderBys": [
  689. ],
  690. "path": "collection"
  691. }
  692. }
  693. ]
  694. },
  695. {
  696. "restart": true,
  697. "expectedState": {
  698. "activeLimboDocs": [
  699. ],
  700. "activeTargets": {
  701. },
  702. "enqueuedLimboDocs": [
  703. ]
  704. }
  705. },
  706. {
  707. "userListen": {
  708. "query": {
  709. "filters": [
  710. ],
  711. "orderBys": [
  712. ],
  713. "path": "collection"
  714. },
  715. "targetId": 2
  716. },
  717. "expectedSnapshotEvents": [
  718. {
  719. "added": [
  720. {
  721. "createTime": 0,
  722. "key": "collection/key",
  723. "options": {
  724. "hasCommittedMutations": false,
  725. "hasLocalMutations": false
  726. },
  727. "value": {
  728. "foo": "bar"
  729. },
  730. "version": 1000
  731. }
  732. ],
  733. "errorCode": 0,
  734. "fromCache": true,
  735. "hasPendingWrites": false,
  736. "query": {
  737. "filters": [
  738. ],
  739. "orderBys": [
  740. ],
  741. "path": "collection"
  742. }
  743. }
  744. ],
  745. "expectedState": {
  746. "activeTargets": {
  747. "2": {
  748. "queries": [
  749. {
  750. "filters": [
  751. ],
  752. "orderBys": [
  753. ],
  754. "path": "collection"
  755. }
  756. ],
  757. "resumeToken": "resume-token-1000"
  758. }
  759. }
  760. }
  761. }
  762. ]
  763. },
  764. "Remote documents from user sets are not GC'd": {
  765. "describeName": "Persistence:",
  766. "itName": "Remote documents from user sets are not GC'd",
  767. "tags": [
  768. ],
  769. "config": {
  770. "numClients": 1,
  771. "useEagerGCForMemory": false
  772. },
  773. "steps": [
  774. {
  775. "userSet": [
  776. "collection/key",
  777. {
  778. "foo": "bar"
  779. }
  780. ]
  781. },
  782. {
  783. "writeAck": {
  784. "version": 1000
  785. },
  786. "expectedState": {
  787. "userCallbacks": {
  788. "acknowledgedDocs": [
  789. "collection/key"
  790. ],
  791. "rejectedDocs": [
  792. ]
  793. }
  794. }
  795. },
  796. {
  797. "userListen": {
  798. "query": {
  799. "filters": [
  800. ],
  801. "orderBys": [
  802. ],
  803. "path": "collection"
  804. },
  805. "targetId": 2
  806. },
  807. "expectedSnapshotEvents": [
  808. {
  809. "added": [
  810. {
  811. "createTime": 0,
  812. "key": "collection/key",
  813. "options": {
  814. "hasCommittedMutations": true,
  815. "hasLocalMutations": false
  816. },
  817. "value": {
  818. "foo": "bar"
  819. },
  820. "version": 1000
  821. }
  822. ],
  823. "errorCode": 0,
  824. "fromCache": true,
  825. "hasPendingWrites": false,
  826. "query": {
  827. "filters": [
  828. ],
  829. "orderBys": [
  830. ],
  831. "path": "collection"
  832. }
  833. }
  834. ],
  835. "expectedState": {
  836. "activeTargets": {
  837. "2": {
  838. "queries": [
  839. {
  840. "filters": [
  841. ],
  842. "orderBys": [
  843. ],
  844. "path": "collection"
  845. }
  846. ],
  847. "resumeToken": ""
  848. }
  849. }
  850. }
  851. }
  852. ]
  853. },
  854. "Remote documents from watch are not GC'd": {
  855. "describeName": "Persistence:",
  856. "itName": "Remote documents from watch are not GC'd",
  857. "tags": [
  858. ],
  859. "config": {
  860. "numClients": 1,
  861. "useEagerGCForMemory": false
  862. },
  863. "steps": [
  864. {
  865. "userListen": {
  866. "query": {
  867. "filters": [
  868. ],
  869. "orderBys": [
  870. ],
  871. "path": "collection"
  872. },
  873. "targetId": 2
  874. },
  875. "expectedState": {
  876. "activeTargets": {
  877. "2": {
  878. "queries": [
  879. {
  880. "filters": [
  881. ],
  882. "orderBys": [
  883. ],
  884. "path": "collection"
  885. }
  886. ],
  887. "resumeToken": ""
  888. }
  889. }
  890. }
  891. },
  892. {
  893. "watchAck": [
  894. 2
  895. ]
  896. },
  897. {
  898. "watchEntity": {
  899. "docs": [
  900. {
  901. "createTime": 0,
  902. "key": "collection/key",
  903. "options": {
  904. "hasCommittedMutations": false,
  905. "hasLocalMutations": false
  906. },
  907. "value": {
  908. "foo": "bar"
  909. },
  910. "version": 1000
  911. }
  912. ],
  913. "targets": [
  914. 2
  915. ]
  916. }
  917. },
  918. {
  919. "watchCurrent": [
  920. [
  921. 2
  922. ],
  923. "resume-token-1000"
  924. ]
  925. },
  926. {
  927. "watchSnapshot": {
  928. "targetIds": [
  929. ],
  930. "version": 1000
  931. },
  932. "expectedSnapshotEvents": [
  933. {
  934. "added": [
  935. {
  936. "createTime": 0,
  937. "key": "collection/key",
  938. "options": {
  939. "hasCommittedMutations": false,
  940. "hasLocalMutations": false
  941. },
  942. "value": {
  943. "foo": "bar"
  944. },
  945. "version": 1000
  946. }
  947. ],
  948. "errorCode": 0,
  949. "fromCache": false,
  950. "hasPendingWrites": false,
  951. "query": {
  952. "filters": [
  953. ],
  954. "orderBys": [
  955. ],
  956. "path": "collection"
  957. }
  958. }
  959. ]
  960. },
  961. {
  962. "userUnlisten": [
  963. 2,
  964. {
  965. "filters": [
  966. ],
  967. "orderBys": [
  968. ],
  969. "path": "collection"
  970. }
  971. ],
  972. "expectedState": {
  973. "activeTargets": {
  974. }
  975. }
  976. },
  977. {
  978. "userListen": {
  979. "query": {
  980. "filters": [
  981. ],
  982. "orderBys": [
  983. ],
  984. "path": "collection"
  985. },
  986. "targetId": 2
  987. },
  988. "expectedSnapshotEvents": [
  989. {
  990. "added": [
  991. {
  992. "createTime": 0,
  993. "key": "collection/key",
  994. "options": {
  995. "hasCommittedMutations": false,
  996. "hasLocalMutations": false
  997. },
  998. "value": {
  999. "foo": "bar"
  1000. },
  1001. "version": 1000
  1002. }
  1003. ],
  1004. "errorCode": 0,
  1005. "fromCache": true,
  1006. "hasPendingWrites": false,
  1007. "query": {
  1008. "filters": [
  1009. ],
  1010. "orderBys": [
  1011. ],
  1012. "path": "collection"
  1013. }
  1014. }
  1015. ],
  1016. "expectedState": {
  1017. "activeTargets": {
  1018. "2": {
  1019. "queries": [
  1020. {
  1021. "filters": [
  1022. ],
  1023. "orderBys": [
  1024. ],
  1025. "path": "collection"
  1026. }
  1027. ],
  1028. "resumeToken": "resume-token-1000"
  1029. }
  1030. }
  1031. }
  1032. }
  1033. ]
  1034. },
  1035. "Single tab acquires primary lease": {
  1036. "describeName": "Persistence:",
  1037. "itName": "Single tab acquires primary lease",
  1038. "tags": [
  1039. "multi-client"
  1040. ],
  1041. "config": {
  1042. "numClients": 2,
  1043. "useEagerGCForMemory": false
  1044. },
  1045. "steps": [
  1046. {
  1047. "clientIndex": 0,
  1048. "drainQueue": true
  1049. },
  1050. {
  1051. "applyClientState": {
  1052. "visibility": "hidden"
  1053. },
  1054. "clientIndex": 0,
  1055. "expectedState": {
  1056. "isPrimary": true
  1057. }
  1058. },
  1059. {
  1060. "clientIndex": 1,
  1061. "drainQueue": true
  1062. },
  1063. {
  1064. "applyClientState": {
  1065. "visibility": "hidden"
  1066. },
  1067. "clientIndex": 1,
  1068. "expectedState": {
  1069. "isPrimary": false
  1070. }
  1071. },
  1072. {
  1073. "clientIndex": 0,
  1074. "drainQueue": true
  1075. },
  1076. {
  1077. "clientIndex": 0,
  1078. "shutdown": true,
  1079. "expectedState": {
  1080. "activeLimboDocs": [
  1081. ],
  1082. "activeTargets": {
  1083. },
  1084. "enqueuedLimboDocs": [
  1085. ]
  1086. }
  1087. },
  1088. {
  1089. "clientIndex": 1,
  1090. "drainQueue": true
  1091. },
  1092. {
  1093. "clientIndex": 1,
  1094. "runTimer": "client_metadata_refresh",
  1095. "expectedState": {
  1096. "isPrimary": true
  1097. }
  1098. }
  1099. ]
  1100. },
  1101. "Visible mutations reflect uid switches": {
  1102. "describeName": "Persistence:",
  1103. "itName": "Visible mutations reflect uid switches",
  1104. "tags": [
  1105. ],
  1106. "config": {
  1107. "numClients": 1,
  1108. "useEagerGCForMemory": true
  1109. },
  1110. "steps": [
  1111. {
  1112. "userListen": {
  1113. "query": {
  1114. "filters": [
  1115. ],
  1116. "orderBys": [
  1117. ],
  1118. "path": "users"
  1119. },
  1120. "targetId": 2
  1121. },
  1122. "expectedState": {
  1123. "activeTargets": {
  1124. "2": {
  1125. "queries": [
  1126. {
  1127. "filters": [
  1128. ],
  1129. "orderBys": [
  1130. ],
  1131. "path": "users"
  1132. }
  1133. ],
  1134. "resumeToken": ""
  1135. }
  1136. }
  1137. }
  1138. },
  1139. {
  1140. "watchAck": [
  1141. 2
  1142. ]
  1143. },
  1144. {
  1145. "watchEntity": {
  1146. "docs": [
  1147. {
  1148. "createTime": 0,
  1149. "key": "users/existing",
  1150. "options": {
  1151. "hasCommittedMutations": false,
  1152. "hasLocalMutations": false
  1153. },
  1154. "value": {
  1155. "uid": "existing"
  1156. },
  1157. "version": 0
  1158. }
  1159. ],
  1160. "targets": [
  1161. 2
  1162. ]
  1163. }
  1164. },
  1165. {
  1166. "watchCurrent": [
  1167. [
  1168. 2
  1169. ],
  1170. "resume-token-500"
  1171. ]
  1172. },
  1173. {
  1174. "watchSnapshot": {
  1175. "targetIds": [
  1176. ],
  1177. "version": 500
  1178. },
  1179. "expectedSnapshotEvents": [
  1180. {
  1181. "added": [
  1182. {
  1183. "createTime": 0,
  1184. "key": "users/existing",
  1185. "options": {
  1186. "hasCommittedMutations": false,
  1187. "hasLocalMutations": false
  1188. },
  1189. "value": {
  1190. "uid": "existing"
  1191. },
  1192. "version": 0
  1193. }
  1194. ],
  1195. "errorCode": 0,
  1196. "fromCache": false,
  1197. "hasPendingWrites": false,
  1198. "query": {
  1199. "filters": [
  1200. ],
  1201. "orderBys": [
  1202. ],
  1203. "path": "users"
  1204. }
  1205. }
  1206. ]
  1207. },
  1208. {
  1209. "userSet": [
  1210. "users/anon",
  1211. {
  1212. "uid": "anon"
  1213. }
  1214. ],
  1215. "expectedSnapshotEvents": [
  1216. {
  1217. "added": [
  1218. {
  1219. "createTime": 0,
  1220. "key": "users/anon",
  1221. "options": {
  1222. "hasCommittedMutations": false,
  1223. "hasLocalMutations": true
  1224. },
  1225. "value": {
  1226. "uid": "anon"
  1227. },
  1228. "version": 0
  1229. }
  1230. ],
  1231. "errorCode": 0,
  1232. "fromCache": false,
  1233. "hasPendingWrites": true,
  1234. "query": {
  1235. "filters": [
  1236. ],
  1237. "orderBys": [
  1238. ],
  1239. "path": "users"
  1240. }
  1241. }
  1242. ]
  1243. },
  1244. {
  1245. "changeUser": "user1",
  1246. "expectedSnapshotEvents": [
  1247. {
  1248. "errorCode": 0,
  1249. "fromCache": false,
  1250. "hasPendingWrites": false,
  1251. "query": {
  1252. "filters": [
  1253. ],
  1254. "orderBys": [
  1255. ],
  1256. "path": "users"
  1257. },
  1258. "removed": [
  1259. {
  1260. "createTime": 0,
  1261. "key": "users/anon",
  1262. "options": {
  1263. "hasCommittedMutations": false,
  1264. "hasLocalMutations": true
  1265. },
  1266. "value": {
  1267. "uid": "anon"
  1268. },
  1269. "version": 0
  1270. }
  1271. ]
  1272. }
  1273. ],
  1274. "expectedState": {
  1275. "activeTargets": {
  1276. "2": {
  1277. "queries": [
  1278. {
  1279. "filters": [
  1280. ],
  1281. "orderBys": [
  1282. ],
  1283. "path": "users"
  1284. }
  1285. ],
  1286. "resumeToken": "resume-token-500"
  1287. }
  1288. }
  1289. }
  1290. },
  1291. {
  1292. "userSet": [
  1293. "users/user1",
  1294. {
  1295. "uid": "user1"
  1296. }
  1297. ],
  1298. "expectedSnapshotEvents": [
  1299. {
  1300. "added": [
  1301. {
  1302. "createTime": 0,
  1303. "key": "users/user1",
  1304. "options": {
  1305. "hasCommittedMutations": false,
  1306. "hasLocalMutations": true
  1307. },
  1308. "value": {
  1309. "uid": "user1"
  1310. },
  1311. "version": 0
  1312. }
  1313. ],
  1314. "errorCode": 0,
  1315. "fromCache": false,
  1316. "hasPendingWrites": true,
  1317. "query": {
  1318. "filters": [
  1319. ],
  1320. "orderBys": [
  1321. ],
  1322. "path": "users"
  1323. }
  1324. }
  1325. ]
  1326. },
  1327. {
  1328. "changeUser": null,
  1329. "expectedSnapshotEvents": [
  1330. {
  1331. "added": [
  1332. {
  1333. "createTime": 0,
  1334. "key": "users/anon",
  1335. "options": {
  1336. "hasCommittedMutations": false,
  1337. "hasLocalMutations": true
  1338. },
  1339. "value": {
  1340. "uid": "anon"
  1341. },
  1342. "version": 0
  1343. }
  1344. ],
  1345. "errorCode": 0,
  1346. "fromCache": false,
  1347. "hasPendingWrites": true,
  1348. "query": {
  1349. "filters": [
  1350. ],
  1351. "orderBys": [
  1352. ],
  1353. "path": "users"
  1354. },
  1355. "removed": [
  1356. {
  1357. "createTime": 0,
  1358. "key": "users/user1",
  1359. "options": {
  1360. "hasCommittedMutations": false,
  1361. "hasLocalMutations": true
  1362. },
  1363. "value": {
  1364. "uid": "user1"
  1365. },
  1366. "version": 0
  1367. }
  1368. ]
  1369. }
  1370. ]
  1371. }
  1372. ]
  1373. },
  1374. "clearPersistence() shuts down other clients": {
  1375. "describeName": "Persistence:",
  1376. "itName": "clearPersistence() shuts down other clients",
  1377. "tags": [
  1378. "multi-client"
  1379. ],
  1380. "config": {
  1381. "numClients": 3,
  1382. "useEagerGCForMemory": false
  1383. },
  1384. "steps": [
  1385. {
  1386. "clientIndex": 0,
  1387. "drainQueue": true
  1388. },
  1389. {
  1390. "applyClientState": {
  1391. "visibility": "visible"
  1392. },
  1393. "clientIndex": 0
  1394. },
  1395. {
  1396. "clientIndex": 1,
  1397. "drainQueue": true
  1398. },
  1399. {
  1400. "clientIndex": 2,
  1401. "drainQueue": true
  1402. },
  1403. {
  1404. "clientIndex": 0,
  1405. "drainQueue": true
  1406. },
  1407. {
  1408. "clientIndex": 0,
  1409. "shutdown": true,
  1410. "expectedState": {
  1411. "activeLimboDocs": [
  1412. ],
  1413. "activeTargets": {
  1414. },
  1415. "enqueuedLimboDocs": [
  1416. ]
  1417. }
  1418. },
  1419. {
  1420. "clearPersistence": true,
  1421. "clientIndex": 0
  1422. },
  1423. {
  1424. "clientIndex": 1,
  1425. "drainQueue": true,
  1426. "expectedState": {
  1427. "isShutdown": true
  1428. }
  1429. },
  1430. {
  1431. "clientIndex": 2,
  1432. "drainQueue": true,
  1433. "expectedState": {
  1434. "isShutdown": true
  1435. }
  1436. }
  1437. ]
  1438. }
  1439. }