Merge lp:~facundo/magicicada-server/update-client-1440 into lp:magicicada-server

Proposed by Facundo Batista
Status: Merged
Approved by: Natalia Bidart
Approved revision: 84
Merged at revision: 84
Proposed branch: lp:~facundo/magicicada-server/update-client-1440
Merge into: lp:magicicada-server
Diff against target: 454 lines (+69/-106)
8 files modified
Makefile.db (+3/-3)
config-manager.txt (+1/-1)
magicicada/server/integtests/test_action_queue.py (+0/-47)
magicicada/server/integtests/test_sync.py (+48/-43)
magicicada/server/server.py (+1/-1)
magicicada/server/testing/aq_helpers.py (+13/-9)
magicicada/server/tests/test_shutdown.py (+1/-1)
magicicada/settings/__init__.py (+2/-1)
To merge this branch: bzr merge lp:~facundo/magicicada-server/update-client-1440
Reviewer Review Type Date Requested Status
Natalia Bidart Approve
Review via email: mp+341765@code.launchpad.net

Commit message

Updated magicicada client to r1440.

Description of the change

Updated magicicada client to r1440.

Had to remove everything related to DNSs rotation for server selection, and update the way the connection info is passed to the client.

Not related to new client, I also needed to change a little something about Django config: send the complain about "no importable local config" to stderr, so it can be avoided when trying to print settings in Makefile.db

Included several aesthetic changes as I need to do those for `make test` to run properly... in the next branch I'll pin the flake8 revision in the venv so no more of these "spurious fixes" bother us.

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile.db'
--- Makefile.db 2016-03-08 00:32:28 +0000
+++ Makefile.db 2018-03-20 19:58:45 +0000
@@ -1,7 +1,7 @@
1SHELL_ENV = DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) PYTHONPATH=$(PYTHONPATH)1SHELL_ENV = DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) PYTHONPATH=$(PYTHONPATH)
2PGNAME = $(shell $(SHELL_ENV) $(PYTHON) -c "from django.conf import settings; print settings.DATABASES['default']['NAME']")2PGNAME = $(shell $(SHELL_ENV) $(PYTHON) -c "from django.conf import settings; print settings.DATABASES['default']['NAME']" 2> /dev/null)
3PGHOST = $(shell $(SHELL_ENV) $(PYTHON) -c "from django.conf import settings; print settings.DATABASES['default']['HOST']")3PGHOST = $(shell $(SHELL_ENV) $(PYTHON) -c "from django.conf import settings; print settings.DATABASES['default']['HOST']" 2> /dev/null)
4PGUSER = $(shell $(SHELL_ENV) $(PYTHON) -c "from django.conf import settings; print settings.DATABASES['default']['USER']")4PGUSER = $(shell $(SHELL_ENV) $(PYTHON) -c "from django.conf import settings; print settings.DATABASES['default']['USER']" 2> /dev/null)
5DATA_DIR = $(PGHOST)/data5DATA_DIR = $(PGHOST)/data
6LOG_FILE = $(PGHOST)/postgresql.log6LOG_FILE = $(PGHOST)/postgresql.log
7CONF_FILE = $(PGHOST)/postgresql.conf7CONF_FILE = $(PGHOST)/postgresql.conf
88
=== modified file 'config-manager.txt'
--- config-manager.txt 2017-04-22 21:07:36 +0000
+++ config-manager.txt 2018-03-20 19:58:45 +0000
@@ -25,5 +25,5 @@
25./.sourcecode/dirspec ~ubuntuone-control-tower/dirspec/trunk;revno=1425./.sourcecode/dirspec ~ubuntuone-control-tower/dirspec/trunk;revno=14
26./.sourcecode/django ~ubuntuone-pqm-team/django/stable;revno=1726./.sourcecode/django ~ubuntuone-pqm-team/django/stable;revno=17
27./.sourcecode/u1sync ~facundo/u1sync/opensourcing;revno=1027./.sourcecode/u1sync ~facundo/u1sync/opensourcing;revno=10
28./.sourcecode/magicicada-client ~chicharreros/magicicada-client/trunk;revno=143328./.sourcecode/magicicada-client ~chicharreros/magicicada-client/trunk;revno=1440
29./.sourcecode/magicicada-protocol ~chicharreros/magicicada-protocol/trunk;revno=16929./.sourcecode/magicicada-protocol ~chicharreros/magicicada-protocol/trunk;revno=169
3030
=== modified file 'magicicada/server/integtests/test_action_queue.py'
--- magicicada/server/integtests/test_action_queue.py 2016-06-07 19:06:06 +0000
+++ magicicada/server/integtests/test_action_queue.py 2018-03-20 19:58:45 +0000
@@ -35,13 +35,11 @@
35 ActionQueue,35 ActionQueue,
36 Download,36 Download,
37 Upload,37 Upload,
38 dns_client,
39)38)
40from ubuntuone.syncdaemon.marker import MDMarker as Marker39from ubuntuone.syncdaemon.marker import MDMarker as Marker
4140
42from magicicada.server.testing.aq_helpers import (41from magicicada.server.testing.aq_helpers import (
43 FakeFailure,42 FakeFailure,
44 FakeResolver,
45 NO_CONTENT_HASH,43 NO_CONTENT_HASH,
46 NoCloseStringIO,44 NoCloseStringIO,
47 TestBase,45 TestBase,
@@ -958,48 +956,3 @@
958 d.addBoth(lambda _: self.main.wait_for_nirvana())956 d.addBoth(lambda _: self.main.wait_for_nirvana())
959 d.addBoth(lambda _: self.eq.push('SYS_USER_DISCONNECT'))957 d.addBoth(lambda _: self.eq.push('SYS_USER_DISCONNECT'))
960 return d958 return d
961
962
963class SRVLookupTest(TestWithDatabase):
964 """ Test for SRV lookup in the ActionQueue. """
965
966 @defer.inlineCallbacks
967 def setUp(self):
968 """
969 Replace the resolver with a FakeResolver
970 """
971 yield super(SRVLookupTest, self).setUp()
972 dns_client.theResolver = FakeResolver()
973
974 @defer.inlineCallbacks
975 def tearDown(self):
976 """
977 By setting the resolver to None, it will be recreated next time a name
978 lookup is done.
979 """
980 yield super(SRVLookupTest, self).tearDown()
981 dns_client.theResolver = None
982
983 def test_SRV_lookup_dev(self):
984 """Test the srv lookup in development mode (localhost:<randomport>)."""
985
986 def checkResult(result):
987 """ Verify that we are correclty doing the lookup """
988 host, port = result
989 self.assertEqual(host, self.aq.host)
990
991 d = self.aq._lookup_srv()
992 d.addCallback(checkResult)
993 return d
994
995 def test_SRV_lookup_prod(self):
996 """ test the srv lookup using a fake resolver. """
997 def checkResult(result):
998 """ Verify that we are correclty doing the lookup """
999 host, port = result
1000 self.assertTrue(host in ['fs-1.server.com', 'fs-0.server.com'],
1001 host)
1002 self.assertEqual(port, 443)
1003 self.aq.dns_srv = '_http._tcp.fs.server.com'
1004 d = self.aq._lookup_srv()
1005 d.addCallback(checkResult)
1006959
=== modified file 'magicicada/server/integtests/test_sync.py'
--- magicicada/server/integtests/test_sync.py 2016-11-07 01:37:46 +0000
+++ magicicada/server/integtests/test_sync.py 2018-03-20 19:58:45 +0000
@@ -113,9 +113,14 @@
113 self.share_source_dir = self.mktemp("source/share")113 self.share_source_dir = self.mktemp("source/share")
114114
115 self.patch(hash_queue, "HASHQUEUE_DELAY", 0.1)115 self.patch(hash_queue, "HASHQUEUE_DELAY", 0.1)
116 connection_info = [{
117 'host': "localhost",
118 'port': self.ssl_port,
119 'use_ssl': True,
120 'disable_ssl_verify': True,
121 }]
116 self.main = Main(root_dir, shares_dir, data_dir, partials_dir,122 self.main = Main(root_dir, shares_dir, data_dir, partials_dir,
117 "localhost", self.ssl_port, dns_srv=None, ssl=True,123 connection_info=connection_info)
118 disable_ssl_verify=True)
119 self.addCleanup(self.main.shutdown)124 self.addCleanup(self.main.shutdown)
120125
121 self.eq = self.main.event_q126 self.eq = self.main.event_q
@@ -972,8 +977,8 @@
972977
973 # check locally and in the server978 # check locally and in the server
974 # it should only be our file in the directory, with content ok979 # it should only be our file in the directory, with content ok
975 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))980 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
976 self.assertEqual(l, ["foo"])981 self.assertEqual(files, ["foo"])
977 self.assertEqual(open(foo_path).read(), ":)")982 self.assertEqual(open(foo_path).read(), ":)")
978 yield self.compare_server()983 yield self.compare_server()
979984
@@ -1130,8 +1135,8 @@
1130 yield self.main.wait_for_nirvana(.5)1135 yield self.main.wait_for_nirvana(.5)
11311136
1132 # check that everything is ok: it should only be our file in the dir...1137 # check that everything is ok: it should only be our file in the dir...
1133 l = os.listdir(dir2)1138 files = os.listdir(dir2)
1134 self.assertEqual(l, ["test_file"])1139 self.assertEqual(files, ["test_file"])
11351140
1136 # ... and our file should have the correct content1141 # ... and our file should have the correct content
1137 f = open(filepath2)1142 f = open(filepath2)
@@ -1172,8 +1177,8 @@
1172 def local_check(_):1177 def local_check(_):
1173 """Check that everything is ok"""1178 """Check that everything is ok"""
1174 # it should only be our file in the directory1179 # it should only be our file in the directory
1175 l = os.listdir(dir2)1180 files = os.listdir(dir2)
1176 self.assertEqual(l, ["test_file"])1181 self.assertEqual(files, ["test_file"])
11771182
1178 # our file should have the correct content1183 # our file should have the correct content
1179 f = open(filepath2)1184 f = open(filepath2)
@@ -1233,8 +1238,8 @@
12331238
1234 # wait dust to settle, check locally and in the server1239 # wait dust to settle, check locally and in the server
1235 yield self.main.wait_for_nirvana(.5)1240 yield self.main.wait_for_nirvana(.5)
1236 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1241 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1237 self.assertEqual(l, ["test_file"])1242 self.assertEqual(files, ["test_file"])
1238 yield self.compare_server()1243 yield self.compare_server()
12391244
1240 @defer.inlineCallbacks1245 @defer.inlineCallbacks
@@ -1317,8 +1322,8 @@
1317 yield self.main.wait_for_nirvana(0.5)1322 yield self.main.wait_for_nirvana(0.5)
13181323
1319 # check that everything is ok1324 # check that everything is ok
1320 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1325 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1321 self.assertEqual(l, ["test_file"])1326 self.assertEqual(files, ["test_file"])
1322 with open(self.root_dir + "/test_file") as f:1327 with open(self.root_dir + "/test_file") as f:
1323 content = f.read()1328 content = f.read()
1324 self.assertEqual(content, ":)")1329 self.assertEqual(content, ":)")
@@ -1474,8 +1479,8 @@
14741479
1475 def local_check(_):1480 def local_check(_):
1476 """check that everything is in sync"""1481 """check that everything is in sync"""
1477 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1482 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1478 self.assertEqual(l, ["test_file"])1483 self.assertEqual(files, ["test_file"])
14791484
1480 final_data = open(self.root_dir + '/test_file').read()1485 final_data = open(self.root_dir + '/test_file').read()
1481 self.assertEqual(data, final_data)1486 self.assertEqual(data, final_data)
@@ -1503,8 +1508,8 @@
15031508
1504 def content_check(_):1509 def content_check(_):
1505 """Check that everything is in sync."""1510 """Check that everything is in sync."""
1506 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1511 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1507 self.assertEqual(l, ["test_dir"])1512 self.assertEqual(files, ["test_dir"])
1508 self.assertTrue(stat.S_ISDIR(1513 self.assertTrue(stat.S_ISDIR(
1509 os.stat(self.root_dir + '/test_dir')[stat.ST_MODE]))1514 os.stat(self.root_dir + '/test_dir')[stat.ST_MODE]))
15101515
@@ -1564,8 +1569,8 @@
1564 yield self.main.wait_for_nirvana(.5)1569 yield self.main.wait_for_nirvana(.5)
15651570
1566 # it should only be our file in the directory1571 # it should only be our file in the directory
1567 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1572 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1568 self.assertEqual(l, ["test_file"])1573 self.assertEqual(files, ["test_file"])
15691574
1570 # our file should have the full content1575 # our file should have the full content
1571 filesize = os.stat(self.root_dir + "/test_file").st_size1576 filesize = os.stat(self.root_dir + "/test_file").st_size
@@ -1610,8 +1615,8 @@
1610 yield self.main.wait_for_nirvana(.5)1615 yield self.main.wait_for_nirvana(.5)
16111616
1612 # we should have both files...1617 # we should have both files...
1613 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1618 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1614 self.assertEqual(sorted(l), ["test_file", "test_file.u1conflict"])1619 self.assertEqual(sorted(files), ["test_file", "test_file.u1conflict"])
16151620
1616 # ...with the respective content1621 # ...with the respective content
1617 sanefile = open(test_file).read()1622 sanefile = open(test_file).read()
@@ -1631,8 +1636,8 @@
1631 yield self.main.wait_for_nirvana(.5)1636 yield self.main.wait_for_nirvana(.5)
16321637
1633 # finally, only one file with right content1638 # finally, only one file with right content
1634 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1639 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1635 self.assertEqual(sorted(l), ["test_file"])1640 self.assertEqual(sorted(files), ["test_file"])
1636 sanefile = open(test_file).read()1641 sanefile = open(test_file).read()
1637 self.assertEqual(sanefile, data_local)1642 self.assertEqual(sanefile, data_local)
1638 yield self.compare_server()1643 yield self.compare_server()
@@ -1647,8 +1652,8 @@
1647 yield self.main.wait_for_nirvana(.5)1652 yield self.main.wait_for_nirvana(.5)
16481653
1649 # finally, only one file with right content1654 # finally, only one file with right content
1650 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1655 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1651 self.assertEqual(sorted(l), ["test_file", "test_file_new"])1656 self.assertEqual(sorted(files), ["test_file", "test_file_new"])
1652 srvfile = open(test_file).read()1657 srvfile = open(test_file).read()
1653 self.assertEqual(srvfile, data_server)1658 self.assertEqual(srvfile, data_server)
1654 newfile = open(test_file + "_new").read()1659 newfile = open(test_file + "_new").read()
@@ -1703,8 +1708,8 @@
17031708
1704 def no_conflict_check(_):1709 def no_conflict_check(_):
1705 """Check the absence of conflict, and the deletion of the node."""1710 """Check the absence of conflict, and the deletion of the node."""
1706 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1711 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1707 self.assertEqual(l, [])1712 self.assertEqual(files, [])
17081713
1709 d = self.get_client()1714 d = self.get_client()
1710 d.addCallback(self.create_and_check)1715 d.addCallback(self.create_and_check)
@@ -1740,8 +1745,8 @@
1740 self.update_state(None)1745 self.update_state(None)
1741 yield self.main.wait_for_nirvana(.5)1746 yield self.main.wait_for_nirvana(.5)
17421747
1743 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1748 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1744 self.assertEqual(sorted(l), [self.dir_name_conflict])1749 self.assertEqual(sorted(files), [self.dir_name_conflict])
17451750
17461751
1747class TestConflict2(TestServerBase):1752class TestConflict2(TestServerBase):
@@ -1757,7 +1762,7 @@
1757 os.mkdir(self.root_dir + "/test_dir/test_dir")1762 os.mkdir(self.root_dir + "/test_dir/test_dir")
1758 try:1763 try:
1759 yield self.client.unlink(request.ROOT, req.new_id)1764 yield self.client.unlink(request.ROOT, req.new_id)
1760 except:1765 except Exception:
1761 # ignore if the unlink fails1766 # ignore if the unlink fails
1762 pass1767 pass
1763 yield self.main.wait_for_nirvana(0.5)1768 yield self.main.wait_for_nirvana(0.5)
@@ -1840,8 +1845,8 @@
1840 yield self.wait_for_nirvana(.5)1845 yield self.wait_for_nirvana(.5)
18411846
1842 # no conflicts, and the server with correct data1847 # no conflicts, and the server with correct data
1843 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1848 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1844 self.assertEqual(l, ['testfile'])1849 self.assertEqual(files, ['testfile'])
1845 self.assertEqual(open(fname).read(), "other content")1850 self.assertEqual(open(fname).read(), "other content")
1846 yield self.check()1851 yield self.check()
18471852
@@ -1879,8 +1884,8 @@
1879 play_hash()1884 play_hash()
18801885
1881 # check that we don't have conflict, and all is the same with server1886 # check that we don't have conflict, and all is the same with server
1882 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1887 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1883 self.assertEqual(l, ['tfile'])1888 self.assertEqual(files, ['tfile'])
1884 self.assertEqual(open(fname).read(), fcontent)1889 self.assertEqual(open(fname).read(), fcontent)
1885 yield self.check()1890 yield self.check()
18861891
@@ -1916,8 +1921,8 @@
1916 yield self.wait_for_nirvana(.5)1921 yield self.wait_for_nirvana(.5)
19171922
1918 # check that we don't have conflict, and all is the same with server1923 # check that we don't have conflict, and all is the same with server
1919 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1924 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1920 self.assertEqual(l, ['tfile'])1925 self.assertEqual(files, ['tfile'])
1921 self.assertEqual(open(fname).read(), fcontent)1926 self.assertEqual(open(fname).read(), fcontent)
1922 yield self.check()1927 yield self.check()
19231928
@@ -1958,8 +1963,8 @@
1958 yield self.wait_for_nirvana(.5)1963 yield self.wait_for_nirvana(.5)
19591964
1960 # check that we don't have conflict, and all is the same with server1965 # check that we don't have conflict, and all is the same with server
1961 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))1966 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
1962 self.assertEqual(sorted(l), ['tfile'])1967 self.assertEqual(sorted(files), ['tfile'])
1963 self.assertEqual(open(fname).read(), 'foo')1968 self.assertEqual(open(fname).read(), 'foo')
1964 yield self.check()1969 yield self.check()
19651970
@@ -2301,8 +2306,8 @@
2301 self.aq.get_delta(request.ROOT, 0)2306 self.aq.get_delta(request.ROOT, 0)
2302 yield self.main.wait_for_nirvana(0)2307 yield self.main.wait_for_nirvana(0)
23032308
2304 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))2309 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
2305 self.assertEqual(l, ["tfile"])2310 self.assertEqual(files, ["tfile"])
2306 yield self.check()2311 yield self.check()
23072312
2308 @defer.inlineCallbacks2313 @defer.inlineCallbacks
@@ -2494,8 +2499,8 @@
2494 yield wait_download2499 yield wait_download
24952500
2496 # check the node is conflicted, both files with corerct content2501 # check the node is conflicted, both files with corerct content
2497 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))2502 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
2498 self.assertEqual(sorted(l), ["test_file", "test_file.u1conflict"])2503 self.assertEqual(sorted(files), ["test_file", "test_file.u1conflict"])
2499 with open(filepath) as f:2504 with open(filepath) as f:
2500 self.assertEqual(f.read(), ":)")2505 self.assertEqual(f.read(), ":)")
2501 with open(filepath + ".u1conflict") as f:2506 with open(filepath + ".u1conflict") as f:
@@ -2520,8 +2525,8 @@
2520 yield self.main.wait_for_nirvana(0.5)2525 yield self.main.wait_for_nirvana(0.5)
25212526
2522 # check that everything is ok2527 # check that everything is ok
2523 l = filter_symlinks(self.root_dir, os.listdir(self.root_dir))2528 files = filter_symlinks(self.root_dir, os.listdir(self.root_dir))
2524 self.assertEqual(l, ["test_file"])2529 self.assertEqual(files, ["test_file"])
2525 with open(filepath) as f:2530 with open(filepath) as f:
2526 self.assertEqual(f.read(), ":)")2531 self.assertEqual(f.read(), ":)")
25272532
25282533
=== modified file 'magicicada/server/server.py'
--- magicicada/server/server.py 2017-04-22 21:07:36 +0000
+++ magicicada/server/server.py 2018-03-20 19:58:45 +0000
@@ -1698,7 +1698,7 @@
1698 self._log_exception(exc)1698 self._log_exception(exc)
1699 yield self._send_protocol_error(failure)1699 yield self._send_protocol_error(failure)
1700 yield self.done()1700 yield self.done()
1701 except:1701 except Exception:
1702 yield self.internal_error(Failure())1702 yield self.internal_error(Failure())
17031703
1704 def _processMessage(self, message):1704 def _processMessage(self, message):
17051705
=== modified file 'magicicada/server/testing/aq_helpers.py'
--- magicicada/server/testing/aq_helpers.py 2017-04-22 21:07:36 +0000
+++ magicicada/server/testing/aq_helpers.py 2018-03-20 19:58:45 +0000
@@ -165,8 +165,7 @@
165class ReallyFakeMain(main.Main):165class ReallyFakeMain(main.Main):
166 """This main is so fake, it breaks nearly everything."""166 """This main is so fake, it breaks nearly everything."""
167167
168 def __init__(self, port, root_dir, data_dir, partials_dir,168 def __init__(self, port, root_dir, data_dir, partials_dir):
169 dns_srv=None):
170 self.root_dir = root_dir169 self.root_dir = root_dir
171 self.shares_dir = os.path.join(os.path.dirname(root_dir), 'shares_dir')170 self.shares_dir = os.path.join(os.path.dirname(root_dir), 'shares_dir')
172 self.shares_dir_link = os.path.join(root_dir, 'shares_link')171 self.shares_dir_link = os.path.join(root_dir, 'shares_link')
@@ -186,8 +185,13 @@
186 self.event_q.subscribe(self.vm)185 self.event_q.subscribe(self.vm)
187 self.fs.register_eq(self.event_q)186 self.fs.register_eq(self.event_q)
188 self.sync = Sync(self)187 self.sync = Sync(self)
189 self.action_q = ActionQueue(self.event_q, self, '127.0.0.1', port,188 connection_info = [{
190 dns_srv, disable_ssl_verify=True)189 'host': '127.0.0.1',
190 'port': port,
191 'use_ssl': False,
192 'disable_ssl_verify': True,
193 }]
194 self.action_q = ActionQueue(self.event_q, self, connection_info)
191 self.state_manager = main.StateManager(self, handshake_timeout=30)195 self.state_manager = main.StateManager(self, handshake_timeout=30)
192 self.state_manager.connection.waiting_timeout = .1196 self.state_manager.connection.waiting_timeout = .1
193 self.vm.init_root()197 self.vm.init_root()
@@ -353,7 +357,6 @@
353 }357 }
354 user = self.make_user(username=username, password=password)358 user = self.make_user(username=username, password=password)
355 self.storage_users[username] = user359 self.storage_users[username] = user
356 self.dns_srv = None
357360
358 # override and cleanup user config361 # override and cleanup user config
359 self.old_get_config_files = main.config.get_config_files362 self.old_get_config_files = main.config.get_config_files
@@ -442,8 +445,7 @@
442 root_dir = self.mktemp('fake_root_dir')445 root_dir = self.mktemp('fake_root_dir')
443 data_dir = self.mktemp('fake_data_dir')446 data_dir = self.mktemp('fake_data_dir')
444 partials = self.mktemp('partials_dir')447 partials = self.mktemp('partials_dir')
445 self.main = ReallyFakeMain(self.port, root_dir,448 self.main = ReallyFakeMain(self.port, root_dir, data_dir, partials)
446 data_dir, partials, self.dns_srv)
447 self.state = self.main.state_manager449 self.state = self.main.state_manager
448 self.eq = self.main.event_q450 self.eq = self.main.event_q
449 self.listener = ReallyAttentiveListener()451 self.listener = ReallyAttentiveListener()
@@ -765,7 +767,8 @@
765 """Nukes the method"""767 """Nukes the method"""
766 self.old = getattr(self.obj, self.meth)768 self.old = getattr(self.obj, self.meth)
767 if func is None:769 if func is None:
768 def func(*args, **kwargs): return None770 def func(*args, **kwargs):
771 return None
769 setattr(self.obj, self.meth, func)772 setattr(self.obj, self.meth, func)
770 return info773 return info
771774
@@ -808,7 +811,8 @@
808 """Nukes the method"""811 """Nukes the method"""
809 self.old = getattr(self.aq.client, self.meth)812 self.old = getattr(self.aq.client, self.meth)
810 if func is None:813 if func is None:
811 def func(*args, **kwargs): return defer.Deferred814 def func(*args, **kwargs):
815 return defer.Deferred
812 setattr(self.aq.client, self.meth, func)816 setattr(self.aq.client, self.meth, func)
813 return info817 return info
814818
815819
=== modified file 'magicicada/server/tests/test_shutdown.py'
--- magicicada/server/tests/test_shutdown.py 2016-06-03 00:35:53 +0000
+++ magicicada/server/tests/test_shutdown.py 2018-03-20 19:58:45 +0000
@@ -99,7 +99,7 @@
99 try:99 try:
100 yield client.put_content(request.ROOT, mkfile_req.new_id,100 yield client.put_content(request.ROOT, mkfile_req.new_id,
101 empty_hash, "fake_hash", 1234, 1000, None)101 empty_hash, "fake_hash", 1234, 1000, None)
102 except:102 except Exception:
103 client.transport.loseConnection()103 client.transport.loseConnection()
104104
105 ujobs = self.usr0.get_uploadjobs(node_id=mkfile_req.new_id)105 ujobs = self.usr0.get_uploadjobs(node_id=mkfile_req.new_id)
106106
=== modified file 'magicicada/settings/__init__.py'
--- magicicada/settings/__init__.py 2017-06-28 01:37:05 +0000
+++ magicicada/settings/__init__.py 2018-03-20 19:58:45 +0000
@@ -32,6 +32,7 @@
32# Build paths inside the project like this: os.path.join(BASE_DIR, ...)32# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
33import logging33import logging
34import os34import os
35import sys
3536
36from psycopg2.extensions import ISOLATION_LEVEL_REPEATABLE_READ37from psycopg2.extensions import ISOLATION_LEVEL_REPEATABLE_READ
3738
@@ -264,4 +265,4 @@
264try:265try:
265 from magicicada.settings.local import * # noqa266 from magicicada.settings.local import * # noqa
266except ImportError as err:267except ImportError as err:
267 print("ERROR importing local settings:", err)268 print("ERROR importing local settings:", err, file=sys.stderr)

Subscribers

People subscribed via source and target branches

to all changes: