Patchwork [1,of,5] tests: add test for empty CA certs file

login
register
mail settings
Submitter Gregory Szorc
Date June 30, 2016, 2:51 a.m.
Message ID <a5af4aa0c5f18af545f6.1467255079@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/15659/
State Accepted
Headers show

Comments

Gregory Szorc - June 30, 2016, 2:51 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1467249328 25200
#      Wed Jun 29 18:15:28 2016 -0700
# Node ID a5af4aa0c5f18af545f6a7873fb0f7e0e863ec30
# Parent  7dce56174916e09be39c690278942b4f7567b3f6
tests: add test for empty CA certs file

smf reported that an environment with no loaded CA certs resulted
in a weird error. I'd like to detect this a bit better so we can
display an actionable error message.

The actual error being globbed over in this patch is "unknown error"
with a ssl.c line number. That isn't useful at all.

Patch

diff --git a/tests/test-https.t b/tests/test-https.t
--- a/tests/test-https.t
+++ b/tests/test-https.t
@@ -175,16 +175,24 @@  variables in the filename
   searching for changes
   no changes found
   $ P="$CERTSDIR" hg -R copy-pull pull --insecure
   pulling from https://localhost:$HGPORT/
   warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering
   searching for changes
   no changes found
 
+empty cacert file
+
+  $ touch emptycafile
+  $ hg --config web.cacerts=emptycafile -R copy-pull pull
+  pulling from https://localhost:$HGPORT/
+  abort: error: * (glob)
+  [255]
+
 cacert mismatch
 
   $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub.pem" \
   > https://127.0.0.1:$HGPORT/
   pulling from https://127.0.0.1:$HGPORT/
   abort: 127.0.0.1 certificate error: certificate is for localhost
   (set hostsecurity.127.0.0.1:certfingerprints=sha256:62:09:97:2f:97:60:e3:65:8f:12:5d:78:9e:35:a1:36:7a:65:4b:0e:9f:ac:db:c3:bc:6e:b6:a3:c0:16:e0:30 config setting or use --insecure to connect insecurely)
   [255]