Fix the bug.

This commit is contained in:
Itamar Turner-Trauring 2020-11-17 11:25:24 -05:00
parent 9b8b0b1946
commit bb7ed3afc9
2 changed files with 14 additions and 3 deletions

View File

@ -79,9 +79,9 @@ def _common_valid_config():
})
# Add our application versions to the data that Foolscap's LogPublisher
# reports.
# reports. Foolscap requires native strings.
for thing, things_version in list(get_package_versions().items()):
app_versions.add_version(thing, things_version)
app_versions.add_version(ensure_str(thing), ensure_str(things_version))
# group 1 will be addr (dotted quad string), group 3 if any will be portnum (string)
ADDR_RE = re.compile("^([1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*)(:([1-9][0-9]*))?$")

View File

@ -6,7 +6,7 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future.utils import PY2
from future.utils import PY2, native_str
if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
@ -46,6 +46,7 @@ from allmydata.node import (
_tub_portlocation,
formatTimeTahoeStyle,
UnescapedHashError,
get_app_versions,
)
from allmydata.introducer.server import create_introducer
from allmydata import client
@ -100,6 +101,16 @@ class TestCase(testutil.SignalMixin, unittest.TestCase):
# conflict with another service to prove it.
self._available_port = 22
def test_application_versions(self):
"""
Application versions should all have the same type, the native string.
This test is due to the Foolscap limitations, if Foolscap is fixed or
removed it can be deleted.
"""
app_types = set(type(o) for o in get_app_versions())
self.assertEqual(app_types, {native_str})
def _test_location(
self,
expected_addresses,