You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2018/11/06 17:37:38 UTC

svn commit: r1845942 - in /subversion/trunk: Makefile.in build/run_tests.py subversion/tests/cmdline/dav_tests.py subversion/tests/cmdline/svntest/main.py

Author: brane
Date: Tue Nov  6 17:37:38 2018
New Revision: 1845942

URL: http://svn.apache.org/viewvc?rev=1845942&view=rev
Log:
Add a test to check if our client works with GitHub's SVN bridge.

Because testing this involves connecting to a remote server, which our
test suite did not do up to now, the new test is skipped unless such
remote connections are explicitly allowed in the test run.

* Makefile.in (check): Add new option ALLOW_REMOTE_HTTP_CONNECTION.

* build/run_tests.py: Update docstring.
  (create_parser): Add option --allow-remote-http-connection.
  (TestHarness._init_py_tests): Propagate the option to test fixtures.

* subversion/tests/cmdline/dav_tests.py
  (connect_to_github_server): New test case.

* subversion/tests/cmdline/svntest/main.py
  (is_remote_http_connection_allowed): New predicate function.
  (_create_parser): Add option --allow-remote-http-connection.
  (TestSpawningThread.run_one): Propagate the option to subprocesses.

Modified:
    subversion/trunk/Makefile.in
    subversion/trunk/build/run_tests.py
    subversion/trunk/subversion/tests/cmdline/dav_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

Modified: subversion/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/trunk/Makefile.in?rev=1845942&r1=1845941&r2=1845942&view=diff
==============================================================================
--- subversion/trunk/Makefile.in (original)
+++ subversion/trunk/Makefile.in Tue Nov  6 17:37:38 2018
@@ -601,6 +601,9 @@ check: bin @TRANSFORM_LIBTOOL_SCRIPTS@ $
 	  if test "$(FSFS_DIR_DELTIFICATION)" != ""; then                    \
 	    flags="--fsfs-dir-deltification $(FSFS_DIR_DELTIFICATION) $$flags";\
 	  fi;                                                                \
+	  if test "$(ALLOW_REMOTE_HTTP_CONNECTION)" != ""; then              \
+	    flags="--allow-remote-http-connection $$flags";                  \
+	  fi;                                                                \
 	  if test "$(SVN_BIN_DIR)" != ""; then                               \
 	    flags="--bin $(SVN_BIN_DIR) $$flags";                            \
 	  fi;                                                                \

Modified: subversion/trunk/build/run_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/run_tests.py?rev=1845942&r1=1845941&r2=1845942&view=diff
==============================================================================
--- subversion/trunk/build/run_tests.py (original)
+++ subversion/trunk/build/run_tests.py Tue Nov  6 17:37:38 2018
@@ -34,6 +34,7 @@
             [--config-file=<file>] [--ssl-cert=<file>]
             [--exclusive-wc-locks] [--memcached-server=<url:port>]
             [--fsfs-compression=<type>] [--fsfs-dir-deltification=<true|false>]
+            [--allow-remote-http-connection]
             <abs_srcdir> <abs_builddir>
             <prog ...>
 
@@ -280,6 +281,8 @@ class TestHarness:
       cmdline.append('--fsfs-compression=%s' % self.opts.fsfs_compression)
     if self.opts.fsfs_dir_deltification is not None:
       cmdline.append('--fsfs-dir-deltification=%s' % self.opts.fsfs_dir_deltification)
+    if self.opts.allow_remote_http_connection is not None:
+      cmdline.append('--allow-remote-http-connection')
 
     self.py_test_cmdline = cmdline
 
@@ -1033,6 +1036,8 @@ def create_parser():
                     help='Set compression type (for fsfs)')
   parser.add_option('--fsfs-dir-deltification', action='store', type='str',
                     help='Set directory deltification option (for fsfs)')
+  parser.add_option('--allow-remote-http-connection', action='store_true',
+                    help='Run tests that connect to remote HTTP(S) servers')
 
   parser.set_defaults(set_log_level=None)
   return parser

Modified: subversion/trunk/subversion/tests/cmdline/dav_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/dav_tests.py?rev=1845942&r1=1845941&r2=1845942&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/dav_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/dav_tests.py Tue Nov  6 17:37:38 2018
@@ -25,7 +25,10 @@
 ######################################################################
 
 # General modules
-import os, re
+import os, sys
+import re
+import socket
+import traceback
 
 # Our testing module
 import svntest
@@ -64,6 +67,31 @@ def connect_other_dav_server(sbox):
   svntest.actions.run_and_verify_svn([], svntest.verify.AnyOutput,
                                      'info', svntest.main.other_dav_root_url)
 
+#----------------------------------------------------------------------
+
+@XFail()
+@SkipUnless(svntest.main.is_remote_http_connection_allowed)
+def connect_to_github_server(sbox):
+  "connect to GitHub's SVN bridge"
+
+  github_mirror_url = 'https://github.com/apache/subversion/trunk'
+
+  # Skip this test if we can't connect to the GitHub server.
+  # We check this here instead of in a SkipUnless() predicate decorator,
+  # because the decorator's condition function is called seeveral times
+  # during test execution.
+  try:
+    s = socket.create_connection(('github.com', 443), 2)  # 2-second timeout
+    s.close()
+  except:
+    etype, value, _ = sys.exc_info()
+    reason = ''.join(traceback.format_exception_only(etype, value)).rstrip()
+    svntest.main.logger.warn('Connection to github.com failed: ' + reason)
+    raise svntest.Skip
+
+  svntest.actions.run_and_verify_svn(None, [], 'info', github_mirror_url)
+
+
 ########################################################################
 # Run the tests
 
@@ -72,6 +100,7 @@ def connect_other_dav_server(sbox):
 test_list = [ None,
               connect_plain_http_server,
               connect_other_dav_server,
+              connect_to_github_server,
              ]
 
 if __name__ == '__main__':

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1845942&r1=1845941&r2=1845942&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Tue Nov  6 17:37:38 2018
@@ -1695,7 +1695,6 @@ def is_plaintext_password_storage_disabl
     return False
   return True
 
-
 # https://issues.apache.org/bugzilla/show_bug.cgi?id=56480
 # https://issues.apache.org/bugzilla/show_bug.cgi?id=55397
 __mod_dav_url_quoting_broken_versions = frozenset([
@@ -1719,6 +1718,10 @@ def is_httpd_authz_provider_enabled():
       return (v[0] == '2' and int(v[1]) >= 3) or int(v[0]) > 2
     return None
 
+def is_remote_http_connection_allowed():
+  return options.allow_remote_http_connection
+
+
 ######################################################################
 
 
@@ -1799,6 +1802,8 @@ class TestSpawningThread(threading.Threa
       args.append('--fsfs-compression=' + options.fsfs_compression)
     if options.fsfs_dir_deltification:
       args.append('--fsfs-dir-deltification=' + options.fsfs_dir_deltification)
+    if options.allow_remote_http_connection:
+      args.append('--allow-remote-http-connection')
     if options.svn_bin:
       args.append('--bin=' + options.svn_bin)
 
@@ -2217,6 +2222,8 @@ def _create_parser(usage=None):
                     help='Set compression type (for fsfs)')
   parser.add_option('--fsfs-dir-deltification', action='store', type='str',
                     help='Set directory deltification option (for fsfs)')
+  parser.add_option('--allow-remote-http-connection', action='store_true',
+                    help='Run tests that connect to remote HTTP(S) servers')
 
   # most of the defaults are None, but some are other values, set them here
   parser.set_defaults(