Commit 73524dfe authored by Jim Fulton's avatar Jim Fulton

Use 127.0.0.1 and port 0 in more places

parent 7e958f5b
...@@ -340,8 +340,6 @@ def setUp(test): ...@@ -340,8 +340,6 @@ def setUp(test):
test.globs['start_server'] = start_server test.globs['start_server'] = start_server
test.globs['get_port'] = get_port
def stop_server(stop): def stop_server(stop):
stop() stop()
servers.remove(stop) servers.remove(stop)
......
...@@ -17,7 +17,6 @@ import multiprocessing ...@@ -17,7 +17,6 @@ import multiprocessing
import re import re
from ZEO.ClientStorage import ClientStorage, m64 from ZEO.ClientStorage import ClientStorage, m64
from ZEO.tests.forker import get_port
from ZEO.tests import forker, Cache, CommitLockTests, ThreadTests from ZEO.tests import forker, Cache, CommitLockTests, ThreadTests
from ZEO.tests import IterationTests from ZEO.tests import IterationTests
from ZEO._compat import PY3 from ZEO._compat import PY3
...@@ -275,10 +274,9 @@ class FileStorageRecoveryTests(StorageTestBase.StorageTestBase, ...@@ -275,10 +274,9 @@ class FileStorageRecoveryTests(StorageTestBase.StorageTestBase,
""" % tempfile.mktemp(dir='.') """ % tempfile.mktemp(dir='.')
def _new_storage(self): def _new_storage(self):
port = get_port(self) zconf = forker.ZEOConfig(('127.0.0.1', 0))
zconf = forker.ZEOConfig(('', port))
zport, stop = forker.start_zeo_server(self.getConfig(), zport, stop = forker.start_zeo_server(self.getConfig(),
zconf, port) zconf)
self._servers.append(stop) self._servers.append(stop)
blob_cache_dir = tempfile.mkdtemp(dir='.') blob_cache_dir = tempfile.mkdtemp(dir='.')
...@@ -775,7 +773,7 @@ def multiple_storages_invalidation_queue_is_not_insane(): ...@@ -775,7 +773,7 @@ def multiple_storages_invalidation_queue_is_not_insane():
>>> from transaction import commit >>> from transaction import commit
>>> fs1 = FileStorage('t1.fs') >>> fs1 = FileStorage('t1.fs')
>>> fs2 = FileStorage('t2.fs') >>> fs2 = FileStorage('t2.fs')
>>> server = StorageServer(('', get_port()), dict(fs1=fs1, fs2=fs2)) >>> server = StorageServer(None, storages=dict(fs1=fs1, fs2=fs2))
>>> s1 = StorageServerWrapper(server, 'fs1') >>> s1 = StorageServerWrapper(server, 'fs1')
>>> s2 = StorageServerWrapper(server, 'fs2') >>> s2 = StorageServerWrapper(server, 'fs2')
...@@ -804,7 +802,7 @@ def multiple_storages_invalidation_queue_is_not_insane(): ...@@ -804,7 +802,7 @@ def multiple_storages_invalidation_queue_is_not_insane():
>>> sorted([int(u64(oid)) for oid in oids]) >>> sorted([int(u64(oid)) for oid in oids])
[10, 11, 12, 13, 14] [10, 11, 12, 13, 14]
>>> server.close() >>> fs1.close(); fs2.close()
""" """
def getInvalidationsAfterServerRestart(): def getInvalidationsAfterServerRestart():
...@@ -834,7 +832,7 @@ Let's create a file storage and stuff some data into it: ...@@ -834,7 +832,7 @@ Let's create a file storage and stuff some data into it:
Now we'll open a storage server on the data, simulating a restart: Now we'll open a storage server on the data, simulating a restart:
>>> fs = FileStorage('t.fs') >>> fs = FileStorage('t.fs')
>>> sv = StorageServer(('', get_port()), dict(fs=fs)) >>> sv = StorageServer(None, dict(fs=fs))
>>> s = ZEOStorage(sv, sv.read_only) >>> s = ZEOStorage(sv, sv.read_only)
>>> s.notify_connected(FauxConn()) >>> s.notify_connected(FauxConn())
>>> s.register('fs', False) >>> s.register('fs', False)
...@@ -868,7 +866,6 @@ need to be invalidated. This means we'll invalidate objects that ...@@ -868,7 +866,6 @@ need to be invalidated. This means we'll invalidate objects that
dont' need to be invalidated, however, that's better than verifying dont' need to be invalidated, however, that's better than verifying
caches.) caches.)
>>> sv.close()
>>> fs.close() >>> fs.close()
If a storage doesn't implement lastInvalidations, a client can still If a storage doesn't implement lastInvalidations, a client can still
...@@ -880,7 +877,7 @@ without this method: ...@@ -880,7 +877,7 @@ without this method:
... lastInvalidations = property() ... lastInvalidations = property()
>>> fs = FS('t.fs') >>> fs = FS('t.fs')
>>> sv = StorageServer(('', get_port()), dict(fs=fs)) >>> sv = StorageServer(None, dict(fs=fs))
>>> st = StorageServerWrapper(sv, 'fs') >>> st = StorageServerWrapper(sv, 'fs')
>>> s = st.server >>> s = st.server
...@@ -1074,7 +1071,7 @@ def runzeo_without_configfile(): ...@@ -1074,7 +1071,7 @@ def runzeo_without_configfile():
>>> import subprocess, re >>> import subprocess, re
>>> print(re.sub(b'\d\d+|[:]', b'', subprocess.Popen( >>> print(re.sub(b'\d\d+|[:]', b'', subprocess.Popen(
... [sys.executable, 'runzeo', '-a:%s' % get_port(), '-ft', '--test'], ... [sys.executable, 'runzeo', '-a:0', '-ft', '--test'],
... stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ... stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
... ).stdout.read()).decode('ascii')) ... ).stdout.read()).decode('ascii'))
... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
...@@ -1322,6 +1319,7 @@ def read(filename): ...@@ -1322,6 +1319,7 @@ def read(filename):
def runzeo_logrotate_on_sigusr2(): def runzeo_logrotate_on_sigusr2():
""" """
>>> from ZEO.tests.forker import get_port
>>> port = get_port() >>> port = get_port()
>>> with open('c', 'w') as r: >>> with open('c', 'w') as r:
... _ = r.write(''' ... _ = r.write('''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment