changeset 47860:8ae828fd008b stable

clone: automatically glob stream clone output in test Touching `test-clone-stream.t` is very painful otherwise. Differential Revision: https://phab.mercurial-scm.org/D11337
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 25 Aug 2021 10:08:37 +0200
parents 5c17df88f97f
children bf47cc3799ea
files tests/common-pattern.py tests/test-bundle.t tests/test-clone-uncompressed.t tests/test-http-bundle1.t tests/test-stream-bundle-v2.t
diffstat 5 files changed, 25 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/tests/common-pattern.py	Wed Aug 25 09:32:21 2021 +0200
+++ b/tests/common-pattern.py	Wed Aug 25 10:08:37 2021 +0200
@@ -115,6 +115,14 @@
         br'(.*file:/)/?(/\$TESTTMP.*)',
         lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)',
     ),
+    # `hg clone --stream` output
+    (
+        br'transferred (\S+?) KB in \S+? seconds \(.+?/sec\)(?: \(glob\))?(.*)',
+        lambda m: (
+            br'transferred %s KB in * seconds (* */sec) (glob)%s'
+            % (m.group(1), m.group(2))
+        ),
+    ),
 ]
 
 # Various platform error strings, keyed on a common replacement string
--- a/tests/test-bundle.t	Wed Aug 25 09:32:21 2021 +0200
+++ b/tests/test-bundle.t	Wed Aug 25 10:08:37 2021 +0200
@@ -403,7 +403,7 @@
   6 files to transfer, 2.60 KB of data
   pretxnopen: 000000000000
   pretxnclose: aa35859c02ea
-  transferred 2.60 KB in *.* seconds (* */sec) (glob)
+  transferred 2.60 KB in * seconds (* */sec) (glob)
   txnclose: aa35859c02ea
 
 (for safety, confirm visibility of streamclone-ed changes by another
--- a/tests/test-clone-uncompressed.t	Wed Aug 25 09:32:21 2021 +0200
+++ b/tests/test-clone-uncompressed.t	Wed Aug 25 10:08:37 2021 +0200
@@ -331,9 +331,9 @@
   $ hg clone --stream -U http://localhost:$HGPORT clone1
   streaming all changes
   1089 files to transfer, 101 KB of data (no-zstd !)
-  transferred 101 KB in * seconds (*/sec) (glob) (no-zstd !)
+  transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
   1089 files to transfer, 98.5 KB of data (zstd !)
-  transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
+  transferred 98.5 KB in * seconds (* */sec) (glob) (zstd !)
   searching for changes
   no changes found
   $ cat server/errors.txt
@@ -342,7 +342,7 @@
   $ hg clone --stream -U http://localhost:$HGPORT clone1
   streaming all changes
   1092 files to transfer, 101 KB of data (no-zstd !)
-  transferred 101 KB in * seconds (*/sec) (glob) (no-zstd !)
+  transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
   1092 files to transfer, 98.6 KB of data (zstd !)
   transferred 98.6 KB in * seconds (* */sec) (glob) (zstd !)
 
@@ -454,9 +454,9 @@
   $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed
   streaming all changes
   1089 files to transfer, 101 KB of data (no-zstd !)
-  transferred 101 KB in * seconds (*/sec) (glob) (no-zstd !)
+  transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
   1089 files to transfer, 98.5 KB of data (zstd !)
-  transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
+  transferred 98.5 KB in * seconds (* */sec) (glob) (zstd !)
   searching for changes
   no changes found
 #endif
@@ -482,8 +482,8 @@
   1089 files to transfer, 98.5 KB of data (zstd !)
   starting 4 threads for background file closing
   updating the branch cache
-  transferred 101 KB in * seconds (*/sec) (glob) (no-zstd !)
-  transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
+  transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
+  transferred 98.5 KB in * seconds (* */sec) (glob) (zstd !)
   query 1; heads
   sending batch command
   searching for changes
@@ -551,9 +551,9 @@
   $ hg clone --stream -U http://localhost:$HGPORT secret-allowed
   streaming all changes
   1089 files to transfer, 101 KB of data (no-zstd !)
-  transferred 101 KB in * seconds (*/sec) (glob) (no-zstd !)
+  transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
   1089 files to transfer, 98.5 KB of data (zstd !)
-  transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
+  transferred 98.5 KB in * seconds (* */sec) (glob) (zstd !)
   searching for changes
   no changes found
 #endif
@@ -744,9 +744,9 @@
   $ hg clone --stream http://localhost:$HGPORT phase-publish
   streaming all changes
   1089 files to transfer, 101 KB of data (no-zstd !)
-  transferred 101 KB in * seconds (*) (glob) (no-zstd !)
+  transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
   1089 files to transfer, 98.5 KB of data (zstd !)
-  transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
+  transferred 98.5 KB in * seconds (* */sec) (glob) (zstd !)
   searching for changes
   no changes found
   updating to branch default
@@ -793,7 +793,7 @@
   1089 files to transfer, 101 KB of data (no-zstd !)
   transferred 101 KB in * seconds (* */sec) (glob) (no-zstd !)
   1089 files to transfer, 98.5 KB of data (zstd !)
-  transferred 98.5 KB in * seconds (*/sec) (glob) (zstd !)
+  transferred 98.5 KB in * seconds (* */sec) (glob) (zstd !)
   searching for changes
   no changes found
   updating to branch default
--- a/tests/test-http-bundle1.t	Wed Aug 25 09:32:21 2021 +0200
+++ b/tests/test-http-bundle1.t	Wed Aug 25 10:08:37 2021 +0200
@@ -385,7 +385,8 @@
   $ hg clone --stream --noupdate http://localhost:$HGPORT1/ test-stream-clone
   streaming all changes
   * files to transfer, * of data (glob)
-  transferred * in * seconds (* KB/sec) (glob)
+  transferred 1.36 KB in * seconds (* */sec) (glob) (no-zstd !)
+  transferred 1.38 KB in * seconds (* */sec) (glob) (zstd !)
   searching for changes
   no changes found
 #endif
--- a/tests/test-stream-bundle-v2.t	Wed Aug 25 09:32:21 2021 +0200
+++ b/tests/test-stream-bundle-v2.t	Wed Aug 25 10:08:37 2021 +0200
@@ -91,7 +91,7 @@
   adding [c] branch2-served (94 bytes)
   adding [c] rbc-names-v1 (7 bytes)
   adding [c] rbc-revs-v1 (40 bytes)
-  transferred 1.65 KB in \d\.\d seconds \(.*/sec\) (re)
+  transferred 1.65 KB in * seconds (* */sec) (glob)
   bundle2-input-part: total payload size 1840
   bundle2-input-bundle: 1 parts total
   updating the branch cache
@@ -148,7 +148,7 @@
   adding [c] branch2-served (94 bytes)
   adding [c] rbc-names-v1 (7 bytes)
   adding [c] rbc-revs-v1 (40 bytes)
-  transferred 1.65 KB in *.* seconds (*/sec) (glob)
+  transferred 1.65 KB in * seconds (* */sec) (glob)
   bundle2-input-part: total payload size 1840
   bundle2-input-bundle: 1 parts total
   updating the branch cache