persistence_spec_test.json 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. {
  2. "Local mutations are persisted and re-sent": {
  3. "describeName": "Persistence:",
  4. "itName": "Local mutations are persisted and re-sent",
  5. "tags": [
  6. "persistence"
  7. ],
  8. "config": {
  9. "useGarbageCollection": true
  10. },
  11. "steps": [
  12. {
  13. "userSet": [
  14. "collection/key1",
  15. {
  16. "foo": "bar"
  17. }
  18. ]
  19. },
  20. {
  21. "userSet": [
  22. "collection/key2",
  23. {
  24. "baz": "quu"
  25. }
  26. ]
  27. },
  28. {
  29. "restart": true,
  30. "stateExpect": {
  31. "activeTargets": {},
  32. "limboDocs": [],
  33. "numOutstandingWrites": 2
  34. }
  35. },
  36. {
  37. "writeAck": {
  38. "version": 1,
  39. "expectUserCallback": false
  40. }
  41. },
  42. {
  43. "writeAck": {
  44. "version": 2,
  45. "expectUserCallback": false
  46. },
  47. "stateExpect": {
  48. "numOutstandingWrites": 0
  49. }
  50. }
  51. ]
  52. },
  53. "Persisted local mutations are visible to listeners": {
  54. "describeName": "Persistence:",
  55. "itName": "Persisted local mutations are visible to listeners",
  56. "tags": [
  57. "persistence"
  58. ],
  59. "config": {
  60. "useGarbageCollection": true
  61. },
  62. "steps": [
  63. {
  64. "userSet": [
  65. "collection/key1",
  66. {
  67. "foo": "bar"
  68. }
  69. ]
  70. },
  71. {
  72. "userSet": [
  73. "collection/key2",
  74. {
  75. "baz": "quu"
  76. }
  77. ]
  78. },
  79. {
  80. "restart": true,
  81. "stateExpect": {
  82. "activeTargets": {},
  83. "limboDocs": []
  84. }
  85. },
  86. {
  87. "userListen": [
  88. 2,
  89. {
  90. "path": "collection",
  91. "filters": [],
  92. "orderBys": []
  93. }
  94. ],
  95. "stateExpect": {
  96. "activeTargets": {
  97. "2": {
  98. "query": {
  99. "path": "collection",
  100. "filters": [],
  101. "orderBys": []
  102. },
  103. "resumeToken": ""
  104. }
  105. }
  106. },
  107. "expect": [
  108. {
  109. "query": {
  110. "path": "collection",
  111. "filters": [],
  112. "orderBys": []
  113. },
  114. "added": [
  115. [
  116. "collection/key1",
  117. 0,
  118. {
  119. "foo": "bar"
  120. },
  121. "local"
  122. ],
  123. [
  124. "collection/key2",
  125. 0,
  126. {
  127. "baz": "quu"
  128. },
  129. "local"
  130. ]
  131. ],
  132. "errorCode": 0,
  133. "fromCache": true,
  134. "hasPendingWrites": true
  135. }
  136. ]
  137. }
  138. ]
  139. },
  140. "Remote documents are persisted": {
  141. "describeName": "Persistence:",
  142. "itName": "Remote documents are persisted",
  143. "tags": [
  144. "persistence"
  145. ],
  146. "config": {
  147. "useGarbageCollection": true
  148. },
  149. "steps": [
  150. {
  151. "userListen": [
  152. 2,
  153. {
  154. "path": "collection",
  155. "filters": [],
  156. "orderBys": []
  157. }
  158. ],
  159. "stateExpect": {
  160. "activeTargets": {
  161. "2": {
  162. "query": {
  163. "path": "collection",
  164. "filters": [],
  165. "orderBys": []
  166. },
  167. "resumeToken": ""
  168. }
  169. }
  170. }
  171. },
  172. {
  173. "watchAck": [
  174. 2
  175. ]
  176. },
  177. {
  178. "watchEntity": {
  179. "docs": [
  180. [
  181. "collection/key",
  182. 1000,
  183. {
  184. "foo": "bar"
  185. }
  186. ]
  187. ],
  188. "targets": [
  189. 2
  190. ]
  191. }
  192. },
  193. {
  194. "watchCurrent": [
  195. [
  196. 2
  197. ],
  198. "resume-token-1000"
  199. ],
  200. "watchSnapshot": 1000,
  201. "expect": [
  202. {
  203. "query": {
  204. "path": "collection",
  205. "filters": [],
  206. "orderBys": []
  207. },
  208. "added": [
  209. [
  210. "collection/key",
  211. 1000,
  212. {
  213. "foo": "bar"
  214. }
  215. ]
  216. ],
  217. "errorCode": 0,
  218. "fromCache": false,
  219. "hasPendingWrites": false
  220. }
  221. ]
  222. },
  223. {
  224. "restart": true,
  225. "stateExpect": {
  226. "activeTargets": {},
  227. "limboDocs": []
  228. }
  229. },
  230. {
  231. "userListen": [
  232. 2,
  233. {
  234. "path": "collection",
  235. "filters": [],
  236. "orderBys": []
  237. }
  238. ],
  239. "stateExpect": {
  240. "activeTargets": {
  241. "2": {
  242. "query": {
  243. "path": "collection",
  244. "filters": [],
  245. "orderBys": []
  246. },
  247. "resumeToken": "resume-token-1000"
  248. }
  249. }
  250. },
  251. "expect": [
  252. {
  253. "query": {
  254. "path": "collection",
  255. "filters": [],
  256. "orderBys": []
  257. },
  258. "added": [
  259. [
  260. "collection/key",
  261. 1000,
  262. {
  263. "foo": "bar"
  264. }
  265. ]
  266. ],
  267. "errorCode": 0,
  268. "fromCache": true,
  269. "hasPendingWrites": false
  270. }
  271. ]
  272. }
  273. ]
  274. },
  275. "Remote documents from watch are not GC'd": {
  276. "describeName": "Persistence:",
  277. "itName": "Remote documents from watch are not GC'd",
  278. "tags": [
  279. "persistence"
  280. ],
  281. "config": {
  282. "useGarbageCollection": false
  283. },
  284. "steps": [
  285. {
  286. "userListen": [
  287. 2,
  288. {
  289. "path": "collection",
  290. "filters": [],
  291. "orderBys": []
  292. }
  293. ],
  294. "stateExpect": {
  295. "activeTargets": {
  296. "2": {
  297. "query": {
  298. "path": "collection",
  299. "filters": [],
  300. "orderBys": []
  301. },
  302. "resumeToken": ""
  303. }
  304. }
  305. }
  306. },
  307. {
  308. "watchAck": [
  309. 2
  310. ]
  311. },
  312. {
  313. "watchEntity": {
  314. "docs": [
  315. [
  316. "collection/key",
  317. 1000,
  318. {
  319. "foo": "bar"
  320. }
  321. ]
  322. ],
  323. "targets": [
  324. 2
  325. ]
  326. }
  327. },
  328. {
  329. "watchCurrent": [
  330. [
  331. 2
  332. ],
  333. "resume-token-1000"
  334. ],
  335. "watchSnapshot": 1000,
  336. "expect": [
  337. {
  338. "query": {
  339. "path": "collection",
  340. "filters": [],
  341. "orderBys": []
  342. },
  343. "added": [
  344. [
  345. "collection/key",
  346. 1000,
  347. {
  348. "foo": "bar"
  349. }
  350. ]
  351. ],
  352. "errorCode": 0,
  353. "fromCache": false,
  354. "hasPendingWrites": false
  355. }
  356. ]
  357. },
  358. {
  359. "userUnlisten": [
  360. 2,
  361. {
  362. "path": "collection",
  363. "filters": [],
  364. "orderBys": []
  365. }
  366. ],
  367. "stateExpect": {
  368. "activeTargets": {}
  369. }
  370. },
  371. {
  372. "userListen": [
  373. 2,
  374. {
  375. "path": "collection",
  376. "filters": [],
  377. "orderBys": []
  378. }
  379. ],
  380. "stateExpect": {
  381. "activeTargets": {
  382. "2": {
  383. "query": {
  384. "path": "collection",
  385. "filters": [],
  386. "orderBys": []
  387. },
  388. "resumeToken": "resume-token-1000"
  389. }
  390. }
  391. },
  392. "expect": [
  393. {
  394. "query": {
  395. "path": "collection",
  396. "filters": [],
  397. "orderBys": []
  398. },
  399. "added": [
  400. [
  401. "collection/key",
  402. 1000,
  403. {
  404. "foo": "bar"
  405. }
  406. ]
  407. ],
  408. "errorCode": 0,
  409. "fromCache": true,
  410. "hasPendingWrites": false
  411. }
  412. ]
  413. }
  414. ]
  415. },
  416. "Remote documents from user sets are not GC'd": {
  417. "describeName": "Persistence:",
  418. "itName": "Remote documents from user sets are not GC'd",
  419. "tags": [
  420. "persistence"
  421. ],
  422. "config": {
  423. "useGarbageCollection": false
  424. },
  425. "steps": [
  426. {
  427. "userSet": [
  428. "collection/key",
  429. {
  430. "foo": "bar"
  431. }
  432. ]
  433. },
  434. {
  435. "writeAck": {
  436. "version": 1000,
  437. "expectUserCallback": true
  438. }
  439. },
  440. {
  441. "userListen": [
  442. 2,
  443. {
  444. "path": "collection",
  445. "filters": [],
  446. "orderBys": []
  447. }
  448. ],
  449. "stateExpect": {
  450. "activeTargets": {
  451. "2": {
  452. "query": {
  453. "path": "collection",
  454. "filters": [],
  455. "orderBys": []
  456. },
  457. "resumeToken": ""
  458. }
  459. }
  460. },
  461. "expect": [
  462. {
  463. "query": {
  464. "path": "collection",
  465. "filters": [],
  466. "orderBys": []
  467. },
  468. "added": [
  469. [
  470. "collection/key",
  471. 0,
  472. {
  473. "foo": "bar"
  474. }
  475. ]
  476. ],
  477. "errorCode": 0,
  478. "fromCache": true,
  479. "hasPendingWrites": false
  480. }
  481. ]
  482. }
  483. ]
  484. },
  485. "Mutation Queue is persisted across uid switches": {
  486. "describeName": "Persistence:",
  487. "itName": "Mutation Queue is persisted across uid switches",
  488. "tags": [
  489. "persistence"
  490. ],
  491. "config": {
  492. "useGarbageCollection": true
  493. },
  494. "steps": [
  495. {
  496. "userSet": [
  497. "users/anon",
  498. {
  499. "uid": "anon"
  500. }
  501. ]
  502. },
  503. {
  504. "changeUser": "user1",
  505. "stateExpect": {
  506. "numOutstandingWrites": 0
  507. }
  508. },
  509. {
  510. "userSet": [
  511. "users/user1",
  512. {
  513. "uid": "user1"
  514. }
  515. ]
  516. },
  517. {
  518. "userSet": [
  519. "users/user1",
  520. {
  521. "uid": "user1",
  522. "extra": true
  523. }
  524. ]
  525. },
  526. {
  527. "changeUser": null,
  528. "stateExpect": {
  529. "numOutstandingWrites": 1
  530. }
  531. },
  532. {
  533. "writeAck": {
  534. "version": 1000,
  535. "expectUserCallback": true
  536. }
  537. },
  538. {
  539. "changeUser": "user1",
  540. "stateExpect": {
  541. "numOutstandingWrites": 2
  542. }
  543. },
  544. {
  545. "writeAck": {
  546. "version": 2000,
  547. "expectUserCallback": true
  548. }
  549. },
  550. {
  551. "writeAck": {
  552. "version": 3000,
  553. "expectUserCallback": true
  554. }
  555. }
  556. ]
  557. },
  558. "Mutation Queue is persisted across uid switches (with restarts)": {
  559. "describeName": "Persistence:",
  560. "itName": "Mutation Queue is persisted across uid switches (with restarts)",
  561. "tags": [
  562. "persistence"
  563. ],
  564. "config": {
  565. "useGarbageCollection": true
  566. },
  567. "steps": [
  568. {
  569. "userSet": [
  570. "users/anon",
  571. {
  572. "uid": "anon"
  573. }
  574. ]
  575. },
  576. {
  577. "changeUser": "user1",
  578. "stateExpect": {
  579. "numOutstandingWrites": 0
  580. }
  581. },
  582. {
  583. "userSet": [
  584. "users/user1",
  585. {
  586. "uid": "user1"
  587. }
  588. ]
  589. },
  590. {
  591. "userSet": [
  592. "users/user1",
  593. {
  594. "uid": "user1",
  595. "extra": true
  596. }
  597. ]
  598. },
  599. {
  600. "changeUser": null
  601. },
  602. {
  603. "restart": true,
  604. "stateExpect": {
  605. "activeTargets": {},
  606. "limboDocs": [],
  607. "numOutstandingWrites": 1
  608. }
  609. },
  610. {
  611. "writeAck": {
  612. "version": 1000,
  613. "expectUserCallback": false
  614. }
  615. },
  616. {
  617. "changeUser": "user1"
  618. },
  619. {
  620. "restart": true,
  621. "stateExpect": {
  622. "activeTargets": {},
  623. "limboDocs": [],
  624. "numOutstandingWrites": 2
  625. }
  626. },
  627. {
  628. "writeAck": {
  629. "version": 2000,
  630. "expectUserCallback": false
  631. }
  632. },
  633. {
  634. "writeAck": {
  635. "version": 3000,
  636. "expectUserCallback": false
  637. }
  638. }
  639. ]
  640. },
  641. "Visible mutations reflect uid switches": {
  642. "describeName": "Persistence:",
  643. "itName": "Visible mutations reflect uid switches",
  644. "tags": [
  645. "persistence"
  646. ],
  647. "config": {
  648. "useGarbageCollection": true
  649. },
  650. "steps": [
  651. {
  652. "userListen": [
  653. 2,
  654. {
  655. "path": "users",
  656. "filters": [],
  657. "orderBys": []
  658. }
  659. ],
  660. "stateExpect": {
  661. "activeTargets": {
  662. "2": {
  663. "query": {
  664. "path": "users",
  665. "filters": [],
  666. "orderBys": []
  667. },
  668. "resumeToken": ""
  669. }
  670. }
  671. }
  672. },
  673. {
  674. "watchAck": [
  675. 2
  676. ]
  677. },
  678. {
  679. "watchEntity": {
  680. "docs": [
  681. [
  682. "users/existing",
  683. 0,
  684. {
  685. "uid": "existing"
  686. }
  687. ]
  688. ],
  689. "targets": [
  690. 2
  691. ]
  692. }
  693. },
  694. {
  695. "watchCurrent": [
  696. [
  697. 2
  698. ],
  699. "resume-token-500"
  700. ],
  701. "watchSnapshot": 500,
  702. "expect": [
  703. {
  704. "query": {
  705. "path": "users",
  706. "filters": [],
  707. "orderBys": []
  708. },
  709. "added": [
  710. [
  711. "users/existing",
  712. 0,
  713. {
  714. "uid": "existing"
  715. }
  716. ]
  717. ],
  718. "errorCode": 0,
  719. "fromCache": false,
  720. "hasPendingWrites": false
  721. }
  722. ]
  723. },
  724. {
  725. "userSet": [
  726. "users/anon",
  727. {
  728. "uid": "anon"
  729. }
  730. ],
  731. "expect": [
  732. {
  733. "query": {
  734. "path": "users",
  735. "filters": [],
  736. "orderBys": []
  737. },
  738. "added": [
  739. [
  740. "users/anon",
  741. 0,
  742. {
  743. "uid": "anon"
  744. },
  745. "local"
  746. ]
  747. ],
  748. "errorCode": 0,
  749. "fromCache": false,
  750. "hasPendingWrites": true
  751. }
  752. ]
  753. },
  754. {
  755. "changeUser": "user1",
  756. "stateExpect": {
  757. "activeTargets": {
  758. "2": {
  759. "query": {
  760. "path": "users",
  761. "filters": [],
  762. "orderBys": []
  763. },
  764. "resumeToken": "resume-token-500"
  765. }
  766. }
  767. },
  768. "expect": [
  769. {
  770. "query": {
  771. "path": "users",
  772. "filters": [],
  773. "orderBys": []
  774. },
  775. "removed": [
  776. [
  777. "users/anon",
  778. 0,
  779. {
  780. "uid": "anon"
  781. },
  782. "local"
  783. ]
  784. ],
  785. "errorCode": 0,
  786. "fromCache": false,
  787. "hasPendingWrites": false
  788. }
  789. ]
  790. },
  791. {
  792. "userSet": [
  793. "users/user1",
  794. {
  795. "uid": "user1"
  796. }
  797. ],
  798. "expect": [
  799. {
  800. "query": {
  801. "path": "users",
  802. "filters": [],
  803. "orderBys": []
  804. },
  805. "added": [
  806. [
  807. "users/user1",
  808. 0,
  809. {
  810. "uid": "user1"
  811. },
  812. "local"
  813. ]
  814. ],
  815. "errorCode": 0,
  816. "fromCache": false,
  817. "hasPendingWrites": true
  818. }
  819. ]
  820. },
  821. {
  822. "changeUser": null,
  823. "expect": [
  824. {
  825. "query": {
  826. "path": "users",
  827. "filters": [],
  828. "orderBys": []
  829. },
  830. "added": [
  831. [
  832. "users/anon",
  833. 0,
  834. {
  835. "uid": "anon"
  836. },
  837. "local"
  838. ]
  839. ],
  840. "removed": [
  841. [
  842. "users/user1",
  843. 0,
  844. {
  845. "uid": "user1"
  846. },
  847. "local"
  848. ]
  849. ],
  850. "errorCode": 0,
  851. "fromCache": false,
  852. "hasPendingWrites": true
  853. }
  854. ]
  855. }
  856. ]
  857. }
  858. }