Просмотр исходного кода

test(rtc): debug sync page1 from client1 -> client2

rcmerci 1 год назад
Родитель
Сommit
98bbbc8408

+ 6 - 2
src/main/frontend/worker/rtc/remote_update.cljs

@@ -552,9 +552,13 @@
               update-ops (vals update-ops-map)
               update-page-ops (vals update-page-ops-map)
               remove-page-ops (vals remove-page-ops-map)]
-
+          (when rtc-const/RTC-E2E-TEST
+            (prn :debug-remote-update-data remote-update-data))
           (js/console.groupCollapsed "rtc/apply-remote-ops-log")
-          (batch-tx/with-batch-tx-mode conn {:rtc-tx? true :persist-op? false :gen-undo-ops? false}
+          (batch-tx/with-batch-tx-mode conn {:rtc-tx? true
+                                             :persist-op? false
+                                             :gen-undo-ops? false
+                                             :skip-store-conn rtc-const/RTC-E2E-TEST}
             (worker-util/profile :ensure-refed-blocks-exist (ensure-refed-blocks-exist repo conn refed-blocks))
             (worker-util/profile :apply-remote-update-page-ops (apply-remote-update-page-ops repo conn update-page-ops))
             (worker-util/profile :apply-remote-move-ops (apply-remote-move-ops repo conn sorted-move-ops))

+ 3 - 2
src/rtc_e2e_test/client1_edits.cljs

@@ -13,7 +13,7 @@
   []
   (let [conn (helper/get-downloaded-test-conn)
         tx-data (const/tx-data-map :create-page)]
-    (batch-tx/with-batch-tx-mode conn {:e2e-test const/downloaded-test-repo}
+    (batch-tx/with-batch-tx-mode conn {:e2e-test const/downloaded-test-repo :skip-store-conn true}
       (d/transact! conn tx-data))
     (is (=
          #{[:update-page const/page1-uuid]
@@ -38,7 +38,8 @@
   (m/sp
     (let [r (m/? (m/timeout
                   (m/reduce (fn [_ v]
-                              (when (= :rtc.log/push-local-update (:type v))
+                              (when (and (= :rtc.log/push-local-update (:type v))
+                                         (empty? (client-op/get-all-ops const/downloaded-test-repo)))
                                 (reduced v)))
                             rtc-log-and-state/rtc-log-flow)
                   6000 :timeout))]

+ 2 - 2
src/rtc_e2e_test/const.cljs

@@ -16,9 +16,9 @@
 (def downloaded-test-repo "logseq_db_TEST-REPO-downloaded")
 
 ;;; tests data
-(def page1-uuid (random-uuid))
+(def page1-uuid #uuid "c051d36f-98b3-4afb-b52a-d5a06bd8591d")
 
-(def block1-uuid (random-uuid))
+(def block1-uuid #uuid "aa6d5e60-5d3a-4468-812f-bd60dc9639fb")
 
 (def tx-data-map
   {:create-page