Changeset dd55acce in trunk
- Timestamp:
- 2019-06-26T20:42:43Z (6 years ago)
- Branches:
- master
- Children:
- 47633fb
- Parents:
- 016413b (diff), c169246 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 6 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified .circleci/Dockerfile.centos ¶
r016413b rdd55acce 24 24 COPY . ${BUILD_SRC_ROOT} 25 25 26 RUN "${BUILD_SRC_ROOT}"/.circleci/prepare-image.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" 26 RUN "${BUILD_SRC_ROOT}"/.circleci/prepare-image.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" "python2.7" -
TabularUnified .circleci/Dockerfile.debian ¶
r016413b rdd55acce 24 24 COPY . ${BUILD_SRC_ROOT} 25 25 26 RUN "${BUILD_SRC_ROOT}"/.circleci/prepare-image.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" 26 RUN "${BUILD_SRC_ROOT}"/.circleci/prepare-image.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" "python2.7" 27 27 28 28 # Only the integration tests currently need this but it doesn't hurt to always -
TabularUnified .circleci/Dockerfile.fedora ¶
r016413b rdd55acce 24 24 COPY . ${BUILD_SRC_ROOT} 25 25 26 RUN "${BUILD_SRC_ROOT}"/.circleci/prepare-image.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" 26 RUN "${BUILD_SRC_ROOT}"/.circleci/prepare-image.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" "python2.7" -
TabularUnified .circleci/Dockerfile.slackware ¶
r016413b rdd55acce 47 47 COPY . ${BUILD_SRC_ROOT} 48 48 49 RUN "${BUILD_SRC_ROOT}"/.circleci/prepare-image.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" 49 RUN "${BUILD_SRC_ROOT}"/.circleci/prepare-image.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" "python2.7" -
TabularUnified .circleci/Dockerfile.ubuntu ¶
r016413b rdd55acce 27 27 COPY . ${BUILD_SRC_ROOT} 28 28 29 RUN "${BUILD_SRC_ROOT}"/.circleci/prepare-image.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" 29 RUN "${BUILD_SRC_ROOT}"/.circleci/prepare-image.sh "${WHEELHOUSE_PATH}" "${VIRTUALENV_PATH}" "${BUILD_SRC_ROOT}" "python2.7" -
TabularUnified .circleci/config.yml ¶
r016413b rdd55acce 25 25 26 26 - "slackware-14.2" 27 28 # Test against PyPy 2.7/7.1.1 29 - "pypy2.7-7.1" 27 30 28 31 # Other assorted tasks and configurations … … 60 63 - "build-image-centos-7" 61 64 - "build-image-slackware-14.2" 65 - "build-image-pypy-2.7-7.1.1-jessie" 62 66 63 67 … … 86 90 87 91 environment: &UTF_8_ENVIRONMENT 92 # In general, the test suite is not allowed to fail while the job 93 # succeeds. But you can set this to "yes" if you want it to be 94 # otherwise. 95 ALLOWED_FAILURE: "no" 88 96 # Tell Hypothesis which configuration we want it to use. 89 97 TAHOE_LAFS_HYPOTHESIS_PROFILE: "ci" … … 92 100 LANG: "en_US.UTF-8" 93 101 # Select a tox environment to run for this job. 94 TAHOE_LAFS_TOX_ENVIRONMENT: " coverage"102 TAHOE_LAFS_TOX_ENVIRONMENT: "py27-coverage" 95 103 # Additional arguments to pass to tox. 96 104 TAHOE_LAFS_TOX_ARGS: "" … … 124 132 "/tmp/venv" \ 125 133 "/tmp/project" \ 134 "${ALLOWED_FAILURE}" \ 126 135 "${ARTIFACTS_OUTPUT_PATH}" \ 127 136 "${TAHOE_LAFS_TOX_ENVIRONMENT}" \ … … 156 165 - image: "tahoelafsci/debian:8" 157 166 user: "nobody" 167 168 169 pypy2.7-7.1: 170 <<: *DEBIAN 171 docker: 172 - image: "tahoelafsci/pypy:2.7-7.1.1-jessie" 173 user: "nobody" 174 175 environment: 176 <<: *UTF_8_ENVIRONMENT 177 TAHOE_LAFS_TOX_ENVIRONMENT: "pypy27-coverage" 178 ALLOWED_FAILURE: "yes" 158 179 159 180 … … 407 428 DISTRO: "slackware" 408 429 TAG: "14.2" 430 431 432 build-image-pypy-2.7-7.1.1-jessie: 433 <<: *BUILD_IMAGE 434 435 environment: 436 DISTRO: "pypy" 437 TAG: "2.7-7.1.1-jessie" -
TabularUnified .circleci/create-virtualenv.sh ¶
r016413b rdd55acce 14 14 shift 15 15 16 # The basename of the Python executable (found on PATH) that will be used with 17 # this image. This lets us create a virtualenv that uses the correct Python. 18 PYTHON="$1" 19 shift 20 16 21 # Set up the virtualenv as a non-root user so we can run the test suite as a 17 22 # non-root user. See below. 18 virtualenv --python python2.7"${BOOTSTRAP_VENV}"23 virtualenv --python "${PYTHON}" "${BOOTSTRAP_VENV}" 19 24 20 25 # For convenience. -
TabularUnified .circleci/prepare-image.sh ¶
r016413b rdd55acce 19 19 shift 20 20 21 # The basename of the Python executable (found on PATH) that will be used with 22 # this image. This lets us create a virtualenv that uses the correct Python. 23 PYTHON="$1" 24 shift 25 21 26 "${PROJECT_ROOT}"/.circleci/fix-permissions.sh "${WHEELHOUSE_PATH}" "${BOOTSTRAP_VENV}" "${PROJECT_ROOT}" 22 sudo --set-home -u nobody "${PROJECT_ROOT}"/.circleci/create-virtualenv.sh "${WHEELHOUSE_PATH}" "${BOOTSTRAP_VENV}" 27 sudo --set-home -u nobody "${PROJECT_ROOT}"/.circleci/create-virtualenv.sh "${WHEELHOUSE_PATH}" "${BOOTSTRAP_VENV}" "${PYTHON}" 23 28 sudo --set-home -u nobody "${PROJECT_ROOT}"/.circleci/populate-wheelhouse.sh "${WHEELHOUSE_PATH}" "${BOOTSTRAP_VENV}" "${PROJECT_ROOT}" -
TabularUnified .circleci/run-tests.sh ¶
r016413b rdd55acce 12 12 # know what wheels to get/build, of course. 13 13 PROJECT_ROOT="$1" 14 shift 15 16 ALLOWED_FAILURE="$1" 14 17 shift 15 18 … … 55 58 export PIP_NO_INDEX="1" 56 59 60 if [ "${ALLOWED_FAILURE}" = "yes" ]; then 61 alternative="true" 62 else 63 alternative="false" 64 fi 65 57 66 ${BOOTSTRAP_VENV}/bin/tox \ 58 67 -c ${PROJECT_ROOT}/tox.ini \ 59 68 --workdir /tmp/tahoe-lafs.tox \ 60 69 -e "${TAHOE_LAFS_TOX_ENVIRONMENT}" \ 61 ${TAHOE_LAFS_TOX_ARGS} 70 ${TAHOE_LAFS_TOX_ARGS} || "${alternative}" 62 71 63 72 if [ -n "${ARTIFACTS}" ]; then 64 73 # Create a junitxml results area. 65 74 mkdir -p "$(dirname "${JUNITXML}")" 66 ${BOOTSTRAP_VENV}/bin/subunit2junitxml < "${SUBUNIT2}" > "${JUNITXML}" 75 ${BOOTSTRAP_VENV}/bin/subunit2junitxml < "${SUBUNIT2}" > "${JUNITXML}" || "${alternative}" 67 76 fi -
TabularUnified src/allmydata/_auto_deps.py ¶
r016413b rdd55acce 108 108 # A great way to define types of values. 109 109 "attrs >= 18.2.0", 110 111 # WebSocket library for twisted and asyncio 112 "autobahn >= 19.5.2", 110 113 ] 111 114 -
TabularUnified src/allmydata/client.py ¶
r016413b rdd55acce 206 206 ) 207 207 except Exception: 208 return Failure()208 return defer.fail() 209 209 210 210 … … 260 260 return defer.succeed(client) 261 261 except Exception: 262 return Failure()262 return defer.fail() 263 263 264 264 -
TabularUnified src/allmydata/scripts/tahoe_daemonize.py ¶
r016413b rdd55acce 106 106 subCommands = [("DaemonizeTahoeNode", None, usage.Options, "node")] 107 107 108 stderr = sys.stderr 109 108 110 109 111 class DaemonizeTheRealService(Service, HookMixin): … … 123 125 "running": None, 124 126 } 127 self.stderr = options.parent.stderr 125 128 126 129 def startService(self): … … 144 147 def handle_config_error(fail): 145 148 fail.trap(UnknownConfigError) 146 s ys.stderr.write("\nConfiguration error:\n{}\n\n".format(fail.value))149 self.stderr.write("\nConfiguration error:\n{}\n\n".format(fail.value)) 147 150 reactor.stop() 148 151 return … … 205 208 206 209 twistd_config = MyTwistdConfig() 210 twistd_config.stdout = out 211 twistd_config.stderr = err 207 212 try: 208 213 twistd_config.parseOptions(twistd_args) -
TabularUnified src/allmydata/storage_client.py ¶
r016413b rdd55acce 35 35 from twisted.internet import defer 36 36 from twisted.application import service 37 37 from eliot import ( 38 log_call, 39 ) 38 40 from foolscap.api import eventually 39 41 from allmydata.interfaces import ( … … 91 93 self._connected_high_water_mark = 0 92 94 95 @log_call(action_type=u"storage-client:broker:set-static-servers") 93 96 def set_static_servers(self, servers): 94 for (server_id, server) in servers.items(): 95 assert isinstance(server_id, unicode) # from YAML 96 server_id = server_id.encode("ascii") 97 self._static_server_ids.add(server_id) 98 handler_overrides = server.get("connections", {}) 99 s = NativeStorageServer(server_id, server["ann"], 100 self._tub_maker, handler_overrides) 101 s.on_status_changed(lambda _: self._got_connection()) 102 s.setServiceParent(self) 103 self.servers[server_id] = s 104 s.start_connecting(self._trigger_connections) 97 # Sorting the items gives us a deterministic processing order. This 98 # doesn't really matter but it makes the logging behavior more 99 # predictable and easier to test (and at least one test does depend on 100 # this sorted order). 101 for (server_id, server) in sorted(servers.items()): 102 try: 103 storage_server = self._make_storage_server(server_id, server) 104 except Exception: 105 pass 106 else: 107 self._static_server_ids.add(server_id) 108 self.servers[server_id] = storage_server 109 storage_server.setServiceParent(self) 110 storage_server.start_connecting(self._trigger_connections) 111 112 @log_call( 113 action_type=u"storage-client:broker:make-storage-server", 114 include_args=["server_id"], 115 include_result=False, 116 ) 117 def _make_storage_server(self, server_id, server): 118 assert isinstance(server_id, unicode) # from YAML 119 server_id = server_id.encode("ascii") 120 handler_overrides = server.get("connections", {}) 121 s = NativeStorageServer(server_id, server["ann"], 122 self._tub_maker, handler_overrides) 123 s.on_status_changed(lambda _: self._got_connection()) 124 return s 105 125 106 126 def when_connected_enough(self, threshold): … … 255 275 return "?" 256 276 277 257 278 @implementer(IServer) 258 279 class NativeStorageServer(service.MultiService): -
TabularUnified src/allmydata/test/cli/test_daemonize.py ¶
r016413b rdd55acce 9 9 from allmydata.scripts.tahoe_daemonize import DaemonizeTahoeNodePlugin 10 10 from allmydata.scripts.tahoe_daemonize import DaemonizeOptions 11 from allmydata.scripts.tahoe_daemonize import MyTwistdConfig 11 12 12 13 13 14 class Util(unittest.TestCase): 15 def setUp(self): 16 self.twistd_options = MyTwistdConfig() 17 self.twistd_options.parseOptions(["DaemonizeTahoeNode"]) 18 self.options = self.twistd_options.subOptions 14 19 15 20 def test_node_type_nothing(self): … … 40 45 r.stop = lambda: None 41 46 r.callWhenRunning = call 42 service = plug.makeService( None)47 service = plug.makeService(self.options) 43 48 service.parent = Mock() 44 49 service.startService() … … 56 61 r.callWhenRunning = call 57 62 r.stop = 'foo' 58 service = plug.makeService( None)63 service = plug.makeService(self.options) 59 64 service.parent = Mock() 60 65 # we'll raise ValueError because there's no key-generator … … 81 86 r.stop = lambda: None 82 87 r.callWhenRunning = call 83 service = plug.makeService( None)88 service = plug.makeService(self.options) 84 89 service.parent = Mock() 85 90 with self.assertRaises(ValueError) as ctx: -
TabularUnified src/allmydata/test/cli/test_start.py ¶
r016413b rdd55acce 1 1 import os 2 import sys3 2 import shutil 4 3 import subprocess … … 256 255 257 256 i, o, e = StringIO(), StringIO(), StringIO() 258 with patch.object(sys, 'stdout', o), patch.object(sys, 'stderr', e): 259 runner.dispatch(config, i, o, e) 260 261 output = o.getvalue() 257 runner.dispatch(config, i, o, e) 258 259 output = e.getvalue() 262 260 # should print out the collected logs and an error-code 263 261 self.assertIn( -
TabularUnified src/allmydata/test/test_client.py ¶
r016413b rdd55acce 2 2 import mock 3 3 import twisted 4 from yaml import ( 5 safe_dump, 6 ) 7 from fixtures import ( 8 Fixture, 9 TempDir, 10 ) 11 from eliot.testing import ( 12 capture_logging, 13 assertHasAction, 14 ) 4 15 from twisted.trial import unittest 5 16 from twisted.application import service 6 17 from twisted.internet import defer 18 from twisted.python.filepath import ( 19 FilePath, 20 ) 21 from testtools.matchers import ( 22 Equals, 23 AfterPreprocessing, 24 ) 25 from testtools.twistedsupport import ( 26 succeeded, 27 ) 7 28 8 29 import allmydata … … 21 42 from foolscap.api import flushEventualQueue 22 43 import allmydata.test.common_util as testutil 44 from allmydata.test.common import ( 45 SyncTestCase, 46 ) 23 47 24 48 … … 667 691 668 692 693 def get_known_server_details(a_client): 694 """ 695 Get some details about known storage servers from a client. 696 697 :param _Client a_client: The client to inspect. 698 699 :return: A ``list`` of two-tuples. Each element of the list corresponds 700 to a "known server". The first element of each tuple is a server id. 701 The second is the server's announcement. 702 """ 703 return list( 704 (s.get_serverid(), s.get_announcement()) 705 for s 706 in a_client.storage_broker.get_known_servers() 707 ) 708 709 710 class StaticServers(Fixture): 711 """ 712 Create a ``servers.yaml`` file. 713 """ 714 def __init__(self, basedir, server_details): 715 super(StaticServers, self).__init__() 716 self._basedir = basedir 717 self._server_details = server_details 718 719 def _setUp(self): 720 private = self._basedir.child(u"private") 721 private.makedirs() 722 servers = private.child(u"servers.yaml") 723 servers.setContent(safe_dump({ 724 u"storage": { 725 serverid: { 726 u"ann": announcement, 727 } 728 for (serverid, announcement) 729 in self._server_details 730 }, 731 })) 732 733 734 class StorageClients(SyncTestCase): 735 """ 736 Tests for storage-related behavior of ``_Client``. 737 """ 738 def setUp(self): 739 super(StorageClients, self).setUp() 740 # Some other tests create Nodes and Node mutates tempfile.tempdir and 741 # that screws us up because we're *not* making a Node. "Fix" it. See 742 # https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3052 for the real fix, 743 # though. 744 import tempfile 745 tempfile.tempdir = None 746 747 tempdir = TempDir() 748 self.useFixture(tempdir) 749 self.basedir = FilePath(tempdir.path) 750 751 @capture_logging( 752 lambda case, logger: assertHasAction( 753 case, 754 logger, 755 actionType=u"storage-client:broker:set-static-servers", 756 succeeded=True, 757 ), 758 ) 759 def test_static_servers(self, logger): 760 """ 761 Storage servers defined in ``private/servers.yaml`` are loaded into the 762 storage broker. 763 """ 764 serverid = u"v0-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 765 announcement = { 766 u"nickname": u"some-storage-server", 767 u"anonymous-storage-FURL": u"pb://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@tcp:storage.example:100/swissnum", 768 } 769 self.useFixture( 770 StaticServers( 771 self.basedir, 772 [(serverid, announcement)], 773 ), 774 ) 775 self.assertThat( 776 client.create_client(self.basedir.asTextMode().path), 777 succeeded( 778 AfterPreprocessing( 779 get_known_server_details, 780 Equals([(serverid, announcement)]), 781 ), 782 ), 783 ) 784 785 @capture_logging( 786 lambda case, logger: assertHasAction( 787 case, 788 logger, 789 actionType=u"storage-client:broker:make-storage-server", 790 succeeded=False, 791 ), 792 ) 793 def test_invalid_static_server(self, logger): 794 """ 795 An invalid announcement for a static server does not prevent other static 796 servers from being loaded. 797 """ 798 # Some good details 799 serverid = u"v1-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 800 announcement = { 801 u"nickname": u"some-storage-server", 802 u"anonymous-storage-FURL": u"pb://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@tcp:storage.example:100/swissnum", 803 } 804 self.useFixture( 805 StaticServers( 806 self.basedir, 807 [(serverid, announcement), 808 # Along with a "bad" server announcement. Order in this list 809 # doesn't matter, yaml serializer and Python dicts are going 810 # to shuffle everything around kind of randomly. 811 (u"v0-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", 812 {u"nickname": u"another-storage-server", 813 u"anonymous-storage-FURL": None, 814 }), 815 ], 816 ), 817 ) 818 self.assertThat( 819 client.create_client(self.basedir.asTextMode().path), 820 succeeded( 821 AfterPreprocessing( 822 get_known_server_details, 823 # It should have the good server details. 824 Equals([(serverid, announcement)]), 825 ), 826 ), 827 ) 828 829 669 830 class Run(unittest.TestCase, testutil.StallMixin): 670 831 -
TabularUnified tox.ini ¶
r016413b rdd55acce 8 8 9 9 [tox] 10 envlist = py2710 envlist = {py27,pypy27}{-coverage,} 11 11 minversion = 2.4 12 12
Note: See TracChangeset
for help on using the changeset viewer.