Rev 48: Suspend ftp local test servers support until a better implementation is in http://bazaar.launchpad.net/%7Evila/bzr/local-test-server
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Oct 1 13:51:38 BST 2008
At http://bazaar.launchpad.net/%7Evila/bzr/local-test-server
------------------------------------------------------------
revno: 48
revision-id: v.ladeuil+lp at free.fr-20081001125107-i9rbq4xbhlgahwt8
parent: v.ladeuil+lp at free.fr-20081001124544-kiwhmklwb4q15b9b
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: local_test_server
timestamp: Wed 2008-10-01 14:51:07 +0200
message:
Suspend ftp local test servers support until a better implementation is
found. 'ftp-in-debootstrap' start documenting a possible approach, but is
still to be validated (but sounds already too heayweight for our
purposes).
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2008-06-24 20:06:35 +0000
+++ b/__init__.py 2008-10-01 12:51:07 +0000
@@ -90,6 +90,6 @@
transport.register_lazy_transport(
'http://',
'bzrlib.plugins.local_test_server.test_server', 'HttpTransport_urllib')
-transport.register_lazy_transport(
- 'ftp://',
- 'bzrlib.plugins.local_test_server.test_server', 'FtpTransport')
+#transport.register_lazy_transport(
+# 'ftp://',
+# 'bzrlib.plugins.local_test_server.test_server', 'FtpTransport')
=== modified file 'config.py'
--- a/config.py 2008-06-27 17:38:32 +0000
+++ b/config.py 2008-10-01 12:51:07 +0000
@@ -158,14 +158,14 @@
super(LighttpdDAV, self).__init__('lighttpd-dav', _base_dir=_base_dir)
-class Vsftpd(Config):
-
- def __init__(self, _base_dir=None):
- super(Vsftpd, self).__init__('vsftpd', _base_dir=_base_dir)
-
-
-class Proftpd(Config):
-
- def __init__(self, _base_dir=None):
- super(Proftpd, self).__init__('proftpd', _base_dir=_base_dir)
+#class Vsftpd(Config):
+#
+# def __init__(self, _base_dir=None):
+# super(Vsftpd, self).__init__('vsftpd', _base_dir=_base_dir)
+#
+#
+#class Proftpd(Config):
+#
+# def __init__(self, _base_dir=None):
+# super(Proftpd, self).__init__('proftpd', _base_dir=_base_dir)
=== added file 'ftp-in-debootstrap'
--- a/ftp-in-debootstrap 1970-01-01 00:00:00 +0000
+++ b/ftp-in-debootstrap 2008-10-01 12:51:07 +0000
@@ -0,0 +1,71 @@
+* Rationale
+
+Roughly speaking, trying to run an ftp server without being root
+is a nightmare.
+
+Yet, for tests purposes, we need to be able to start and stop ftp
+servers without being root.
+
+Furthermore, we need the ftp server to be able to access served
+files with write access as the user running the tests ; not only
+via ftp but also directly via the file system. Note that for
+convenience we don't want to restart the ftp server to serve
+directories created by the test framework.
+
+* debootstrap
+
+debootstrap seems to feet the bill, it allows:
+
+1. sudo-like behavior without password prompting
+
+1. running the ftp server as root
+
+1. mounting file systems into the chroot providing access to the
+ outer /tmp
+
+1. creating test users with write access
+
+** configuring schroot
+
+Add the following lines in /etc/schroot/schroot.conf
+
+[hardy]
+type=directory
+location=/home/vila/debootstrap/hardy
+run-setup-scripts=true
+run-exec-scripts=true
+users=vila
+root-users=vila
+
+
+** creating a chroot
+
+cd $HOME
+mkdir -p deboostrap/hardy
+cd deboostrap/hardy
+sudo debootstrap hardy .
+# alternatively try :
+cd deboostrap
+sudo debootstrap hardy hardy
+
+export CHR_HARDY=$HOME/debootstrap/hardy
+sudo cp /etc/apt/sources.list $CHR_HARDY/etc/apt/
+
+schroot -c hardy -u root -- apt-get update
+
+# Don't try the following on a dumb terminal, an emacs shell
+# buffer, or without a controlling terminal
+
+schroot -c hardy -u root -- apt-get upgrade
+
+** install proftpd
+
+When required, ask for running as a standalone (not that we
+really care though since we don't want it to be run
+automatically)
+
+# Don't try the following on a dumb terminal, an emacs shell
+# buffer, or without a controlling terminal
+
+schroot -c hardy -u root -- apt-get install proftpd
+
=== modified file 'server.py'
--- a/server.py 2008-10-01 12:45:44 +0000
+++ b/server.py 2008-10-01 12:51:07 +0000
@@ -635,8 +635,8 @@
_servers['apache2-dav'] = Apache2DAV(37003)
_servers['lighttpd-dav'] = LighttpdDAV(37004)
_servers['apache2-svn'] = Apache2SVN(37005)
-_servers['vsftpd'] = Vsftpd(37006)
-_servers['proftpd'] = Proftpd(37007)
+#_servers['vsftpd'] = Vsftpd(37006)
+#_servers['proftpd'] = Proftpd(37007)
def get_server(name):
=== modified file 'test_server.py'
--- a/test_server.py 2008-06-27 17:38:32 +0000
+++ b/test_server.py 2008-10-01 12:51:07 +0000
@@ -90,14 +90,14 @@
_server_name = 'lighttpd-dav'
-class VsftpdFeature(LocalTestServerFeature):
-
- _server_name = 'vsftpd'
-
-
-class ProftpdFeature(LocalTestServerFeature):
-
- _server_name = 'proftpd'
+#class VsftpdFeature(LocalTestServerFeature):
+#
+# _server_name = 'vsftpd'
+#
+#
+#class ProftpdFeature(LocalTestServerFeature):
+#
+# _server_name = 'proftpd'
class LocalTestServer(transport.Server):
@@ -260,37 +260,37 @@
_url_protocol = 'http+webdav'
-class Vsftpd(LocalFTPTestServer):
-
- _server_name = 'vsftpd'
-
- def _build_base_url(self):
- # We use anonymous to avoid having to store the password of the user
- # running the tests
- return '%s://anonymous@%s:%s' % (self._url_protocol,
- self.host, self.port)
- def get_url(self):
- """See bzrlib.transport.Server.get_url."""
- return self._base_url + self._test_working_dir
-
-
-class Proftpd(LocalFTPTestServer):
-
- _server_name = 'proftpd'
-
- def _build_base_url(self):
- # We use anonymous to avoid having to store the password of the user
- # running the tests
- return '%s://anonymous@%s:%s/' % (self._url_protocol,
- self.host, self.port)
- def get_url(self):
- """See bzrlib.transport.Server.get_url."""
- # Remote the leading /tmp
- prefix = '/tmp/'
- if not self._test_working_dir.startswith(prefix):
- raise AssertionError('%s must start with %s'
- % (self._test_working_dir, prefix))
- return self._base_url + self._test_working_dir[len(prefix):]
+#class Vsftpd(LocalFTPTestServer):
+#
+# _server_name = 'vsftpd'
+#
+# def _build_base_url(self):
+# # We use anonymous to avoid having to store the password of the user
+# # running the tests
+# return '%s://anonymous@%s:%s' % (self._url_protocol,
+# self.host, self.port)
+# def get_url(self):
+# """See bzrlib.transport.Server.get_url."""
+# return self._base_url + self._test_working_dir
+#
+#
+#class Proftpd(LocalFTPTestServer):
+#
+# _server_name = 'proftpd'
+#
+# def _build_base_url(self):
+# # We use anonymous to avoid having to store the password of the user
+# # running the tests
+# return '%s://anonymous@%s:%s/' % (self._url_protocol,
+# self.host, self.port)
+# def get_url(self):
+# """See bzrlib.transport.Server.get_url."""
+# # Remote the leading /tmp
+# prefix = '/tmp/'
+# if not self._test_working_dir.startswith(prefix):
+# raise AssertionError('%s must start with %s'
+# % (self._test_working_dir, prefix))
+# return self._base_url + self._test_working_dir[len(prefix):]
# We have registered a transport for the purpose of adding new servers in the
@@ -335,10 +335,10 @@
if LighttpdDAVFeature().available():
permutations.append((webdav.HttpDavTransport, LighttpdDAV))
- if VsftpdFeature().available():
- permutations.append((FtpTransport, Vsftpd))
-
- if ProftpdFeature().available():
- permutations.append((FtpTransport, Proftpd))
-
+# if VsftpdFeature().available():
+# permutations.append((FtpTransport, Vsftpd))
+#
+# if ProftpdFeature().available():
+# permutations.append((FtpTransport, Proftpd))
+#
return permutations
=== modified file 'tests/test_utils.py'
--- a/tests/test_utils.py 2008-09-01 13:04:47 +0000
+++ b/tests/test_utils.py 2008-10-01 12:51:07 +0000
@@ -116,20 +116,20 @@
_server_feature_class=test_server.LighttpdDAVFeature,
_test_server_class=test_server.LighttpdDAV,
)),
- ('vsftpd', dict(
- _server_name='vsftpd',
- _config_class=config.Vsftpd,
- _server_class=server.Vsftpd,
- _server_feature_class=test_server.VsftpdFeature,
- _test_server_class=test_server.Vsftpd,
- )),
- ('proftpd', dict(
- _server_name='proftpd',
- _config_class=config.Proftpd,
- _server_class=server.Proftpd,
- _server_feature_class=test_server.ProftpdFeature,
- _test_server_class=test_server.Proftpd,
- )),
+# ('vsftpd', dict(
+# _server_name='vsftpd',
+# _config_class=config.Vsftpd,
+# _server_class=server.Vsftpd,
+# _server_feature_class=test_server.VsftpdFeature,
+# _test_server_class=test_server.Vsftpd,
+# )),
+# ('proftpd', dict(
+# _server_name='proftpd',
+# _config_class=config.Proftpd,
+# _server_class=server.Proftpd,
+# _server_feature_class=test_server.ProftpdFeature,
+# _test_server_class=test_server.Proftpd,
+# )),
]
self.scenarios = server_scenarios
More information about the bazaar-commits
mailing list