[gvfs/wip/oholy/dav-tests: 2/4] test: Allow to specify different HTTP port



commit f4552e1c27a8d28bfd90263576432271e65bddf6
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Jan 29 10:44:12 2020 +0100

    test: Allow to specify different HTTP port
    
    Port 8088 is used by something else in our GitLab CI. Allow to specify
    different port over GVFS_TEST_HTTP_PORT environment variable. This will
    allow to fix DAV tests in GitLab CI.

 test/gvfs-test | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/test/gvfs-test b/test/gvfs-test
index 2c37deeb..b2cc28a5 100755
--- a/test/gvfs-test
+++ b/test/gvfs-test
@@ -94,6 +94,10 @@ PTYPE_CDROM = 5
 # local D-BUS daemon
 dbus_daemon = None
 
+http_port = 8088
+if 'GVFS_TEST_HTTP_PORT' in os.environ:
+    http_port = int(os.environ['GVFS_TEST_HTTP_PORT'])
+
 
 class GvfsTestCase(unittest.TestCase):
     '''Gvfs tests base class.
@@ -1391,7 +1395,7 @@ class Dav(GvfsTestCase):
                 modules += 'LoadModule %s_module %s/mod_%s.so\n' % (m, klass.mod_dir, m)
 
         with open(os.path.join(klass.httpd_sandbox, 'apache2.conf'), 'w') as f:
-            f.write('''Listen localhost:8088
+            f.write('''Listen localhost:%(port)s
 Listen localhost:4443
 %(modules)s
 
@@ -1419,7 +1423,7 @@ DAVLockDB DAVLock
   AuthUserFile htpasswd
   Require valid-user
 </Directory>
-''' % {'mod_dir': klass.mod_dir, 'root': klass.httpd_sandbox, 'modules': modules, 'mydir': my_dir})
+''' % {'mod_dir': klass.mod_dir, 'root': klass.httpd_sandbox, 'modules': modules, 'mydir': my_dir, 'port': 
http_port})
 
         # start server
         try:
@@ -1484,7 +1488,7 @@ DAVLockDB DAVLock
     def test_http_noauth(self):
         '''dav://localhost without credentials'''
 
-        uri = 'dav://localhost:8088/public'
+        uri = 'dav://localhost:' + str(http_port) + '/public'
         subprocess.check_call(['gio', 'mount', uri])
         self.do_mount_check(uri, 'hello.txt', 'hi\n')
 
@@ -1507,7 +1511,7 @@ DAVLockDB DAVLock
     def test_http_auth(self):
         '''dav://localhost with credentials'''
 
-        uri = 'dav://localhost:8088/secret'
+        uri = 'dav://localhost:' + str(http_port) + '/secret'
 
         mount = subprocess.Popen(['gio', 'mount', uri],
                                  stdin=subprocess.PIPE,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]