# HG changeset patch # User Matt Harbison # Date 1727832884 14400 # Node ID 73a43fe3e6fdcc59095f07beb42b21ebd4168d4b # Parent e58f02e2f6a903f78793f7dc54dab5a449e6dacf tests: use pattern matching to mask `ECONNREFUSED` messages The second and third one of these in `test-http-proxy.t` was failing on Windows. The others were found by grep and by failed tests when output was matched and an attempt was made to emit the mask pattern. The first clonebundles failure on Windows emitted: error fetching bundle: [WinError 10061] $ECONNREFUSED$ We should probably stringify that better to get rid of the "[WinError 10061]" part. diff -r e58f02e2f6a9 -r 73a43fe3e6fd tests/common-pattern.py --- a/tests/common-pattern.py Sat Oct 05 17:32:26 2024 -0400 +++ b/tests/common-pattern.py Tue Oct 01 21:34:44 2024 -0400 @@ -168,6 +168,12 @@ # FormatMessage(WSAEADDRNOTAVAIL) br'The requested address is not valid in its context', ), + br'$ECONNREFUSED$': ( + # strerror() + br'Connection refused', + # FormatMessage(WSAECONNREFUSED) + br'No connection could be made because the target machine actively refused it', + ), } for replace, msgs in _errors.items(): diff -r e58f02e2f6a9 -r 73a43fe3e6fd tests/test-clone.t --- a/tests/test-clone.t Sat Oct 05 17:32:26 2024 -0400 +++ b/tests/test-clone.t Tue Oct 01 21:34:44 2024 -0400 @@ -618,15 +618,10 @@ No remote source -#if windows $ hg clone http://$LOCALIP:3121/a b - abort: error: * (glob) + abort: error: $ECONNREFUSED$ [100] -#else - $ hg clone http://$LOCALIP:3121/a b - abort: error: *refused* (glob) - [100] -#endif + $ rm -rf b # work around bug with http clone diff -r e58f02e2f6a9 -r 73a43fe3e6fd tests/test-clonebundles.t --- a/tests/test-clonebundles.t Sat Oct 05 17:32:26 2024 -0400 +++ b/tests/test-clonebundles.t Tue Oct 01 21:34:44 2024 -0400 @@ -78,7 +78,7 @@ $ echo "http://localhost:$HGPORT1/bundle.hg" > server/.hg/clonebundles.manifest $ hg clone http://localhost:$HGPORT server-not-runner applying clone bundle from http://localhost:$HGPORT1/bundle.hg - error fetching bundle: (.* refused.*|Protocol not supported|(.* )?\$EADDRNOTAVAIL\$|.* No route to host) (re) + error fetching bundle: (.*\$ECONNREFUSED\$|Protocol not supported|(.* )?\$EADDRNOTAVAIL\$|.* No route to host) (re) abort: error applying bundle (if this error persists, consider contacting the server operator or disable clone bundles via "--config ui.clonebundles=false") [255] diff -r e58f02e2f6a9 -r 73a43fe3e6fd tests/test-http-proxy.t --- a/tests/test-http-proxy.t Sat Oct 05 17:32:26 2024 -0400 +++ b/tests/test-http-proxy.t Tue Oct 01 21:34:44 2024 -0400 @@ -81,7 +81,7 @@ misconfigured hosts) $ http_proxy=localhost:$HGPORT2 hg clone --config http_proxy.always=True http://localhost:$HGPORT/ f - abort: error: (Connection refused|Protocol not supported|.* actively refused it|\$EADDRNOTAVAIL\$|No route to host) (re) + abort: error: (\$ECONNREFUSED\$|Protocol not supported|.* actively refused it|\$EADDRNOTAVAIL\$|No route to host) (re) [100] do not use the proxy if it is in the no list @@ -99,7 +99,7 @@ proxy can't connect to server $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT2/ h - abort: HTTP Error 404: Connection refused + abort: HTTP Error 404: $ECONNREFUSED$ [100] $ cat proxy.log @@ -118,5 +118,5 @@ * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) - * - - [*] code 404, message Connection refused (glob) + * - - [*] code 404, message $ECONNREFUSED$ (glob) $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT2/?cmd=capabilities HTTP/1.1" 404 - (glob) diff -r e58f02e2f6a9 -r 73a43fe3e6fd tests/test-https.t --- a/tests/test-https.t Sat Oct 05 17:32:26 2024 -0400 +++ b/tests/test-https.t Tue Oct 01 21:34:44 2024 -0400 @@ -490,7 +490,7 @@ $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull --insecure https://localhost:0/ pulling from https://localhost:0/ - abort: error: Tunnel connection failed: 404 (Connection refused|\$EADDRNOTAVAIL\$) (re) + abort: error: Tunnel connection failed: 404 (\$ECONNREFUSED\$|\$EADDRNOTAVAIL\$) (re) [100] diff -r e58f02e2f6a9 -r 73a43fe3e6fd tests/test-lfs-serve-access.t --- a/tests/test-lfs-serve-access.t Sat Oct 05 17:32:26 2024 -0400 +++ b/tests/test-lfs-serve-access.t Tue Oct 01 21:34:44 2024 -0400 @@ -83,7 +83,7 @@ [50] $ hg -R httpclone update default --config lfs.url=http://localhost:$HGPORT2/missing - abort: LFS error: *onnection *refused* (glob) (?) + abort: LFS error: $ECONNREFUSED$ (?) abort: LFS error: $EADDRNOTAVAIL$ (glob) (?) abort: LFS error: No route to host (?) (the "lfs.url" config may be used to override http://localhost:$HGPORT2/missing)