Browse Source

test(rtc): insert more blocks to ensure request-message's size is huge

ensure using s3 to upload request-message
rcmerci 1 year ago
parent
commit
480b9a0dae

+ 4 - 4
src/rtc_e2e_test/client_steps.cljs

@@ -74,13 +74,13 @@
              (select-keys block1 [:block/title :block/order :block/parent]))))))))})
 
 (def step2
-  "client1: insert 300 blocks, wait for changes to sync to remote
+  "client1: insert 500 blocks, wait for changes to sync to remote
   client2: wait for blocks to sync from remote"
   {:client1
    (m/sp
      (let [conn (helper/get-downloaded-test-conn)]
        (batch-tx/with-batch-tx-mode conn {:e2e-test const/downloaded-test-repo :skip-store-conn true}
-         (d/transact! conn (const/tx-data-map :insert-300-blocks)))
+         (d/transact! conn (const/tx-data-map :insert-500-blocks)))
        (let [r (m/? (m/timeout
                      (m/reduce (fn [_ v]
                                  (when (and (= :rtc.log/push-local-update (:type v))
@@ -99,8 +99,8 @@
         (when-not (:block/uuid page)
           (throw (ex-info "wait for page to be synced" {:missionary/retry true})))
         (let [blocks (ldb/sort-by-order (ldb/get-page-blocks @conn (:db/id page)))]
-          (is (= 300 (count blocks)))
-          (is (= (map #(str "x" %) (range 300))
+          (is (= 500 (count blocks)))
+          (is (= (map #(str "x" %) (range 500))
                  (map :block/title blocks)))))))})
 
 (defn- wrap-print-step-info

+ 4 - 4
src/rtc_e2e_test/const.cljs

@@ -40,11 +40,11 @@
      :block/parent "page"
      :block/order "a0"
      :block/page "page"}]
-   :insert-300-blocks
+   :insert-500-blocks
    (cons {:db/id "page"
           :block/uuid page2-uuid
-          :block/name "insert-300-blocks"
-          :block/title "insert-300-blocks"
+          :block/name "insert-500-blocks"
+          :block/title "insert-500-blocks"
           :block/created-at 1725024677501
           :block/updated-at 1725024677501
           :block/type "page"
@@ -58,4 +58,4 @@
                  :block/parent "page"
                  :block/order order
                  :block/page "page"})
-              (range 300) (db-order/gen-n-keys 300 "a0" "a1")))})
+              (range 500) (db-order/gen-n-keys 500 "a0" "a1")))})

File diff suppressed because it is too large
+ 1 - 0
src/rtc_e2e_test/example.cljs


+ 2 - 1
src/rtc_e2e_test/fixture.cljs

@@ -50,7 +50,8 @@
                  const/downloaded-test-repo (d/create-conn client-op/schema-in-db))
           (let [{:keys [graph-uuid]} (m/? helper/new-task--upload-example-graph)]
             (assert (some? graph-uuid))
-            (m/? (helper/new-task--wait-creating-graph graph-uuid)))
+            (m/? (helper/new-task--wait-creating-graph graph-uuid))
+            (println :uploaded-graph graph-uuid))
           (done))
         :upload-example-graph-fixture)))})
 

+ 20 - 15
src/rtc_e2e_test/helper.cljs

@@ -26,28 +26,33 @@
   (m/sp
     (let [graphs (m/? (rtc.core/new-task--get-graphs const/test-token))
           test-graphs (filter (fn [graph]
-                                (and (= const/test-repo (:graph-name graph))
-                                     (not= "deleting" (:graph-status graph))))
+                                (not= "deleting" (:graph-status graph)))
                               graphs)]
       (doseq [graph test-graphs]
-        (m/? (rtc.core/new-task--delete-graph const/test-token (:graph-uuid graph)))))))
+        (m/? (rtc.core/new-task--delete-graph const/test-token (:graph-uuid graph)))
+        (println :deleted-graph (:graph-name graph) (:graph-uuid graph))))))
 
 (def new-task--get-remote-example-graph-uuid
   (c.m/backoff
    (take 5 c.m/delays)
    (m/sp
-    (let [graphs (m/? (rtc.core/new-task--get-graphs const/test-token))
-          graph
-          (some (fn [graph]
-                  (when (and (= const/test-graph-name (:graph-name graph))
-                             (not= "deleting" (:graph-status graph)))
-                    graph))
-                graphs)]
-      (when-not graph
-        (throw (ex-info "wait remote-example-graph" {:missionary/retry true})))
-      (when (= "creating" (:graph-status graph))
-        (throw (ex-info "wait remote-example-graph (creating)" {:missionary/retry true})))
-      (:graph-uuid graph)))))
+     (let [graphs (m/? (rtc.core/new-task--get-graphs const/test-token))
+           graph
+           (some (fn [graph]
+                   (when (= const/test-graph-name (:graph-name graph))
+                     graph))
+                 graphs)]
+       (when (= "deleting" (:graph-status graph))
+         (throw (ex-info "example graph status is \"deleting\", check server's background-upload-graph log"
+                         {:graph-name (:graph-name graph)
+                          :graph-uuid (:graph-uuid graph)})))
+       (when-not graph
+         (throw (ex-info "wait remote-example-graph" {:missionary/retry true
+                                                      :graphs graphs})))
+       (when (= "creating" (:graph-status graph))
+         (throw (ex-info "wait remote-example-graph (creating)" {:missionary/retry true
+                                                                 :graphs graphs})))
+       (:graph-uuid graph)))))
 
 (defn new-task--download-graph
   [graph-uuid graph-name]

Some files were not shown because too many files changed in this diff