Merge lp:~facundo/ubuntuone-client/log-version-number into lp:ubuntuone-client

Proposed by Facundo Batista
Status: Merged
Approved by: Facundo Batista
Approved revision: 936
Merged at revision: 939
Proposed branch: lp:~facundo/ubuntuone-client/log-version-number
Merge into: lp:ubuntuone-client
Diff against target: 80 lines (+22/-1)
2 files modified
tests/syncdaemon/test_main.py (+19/-0)
ubuntuone/syncdaemon/main.py (+3/-1)
To merge this branch: bzr merge lp:~facundo/ubuntuone-client/log-version-number
Reviewer Review Type Date Requested Status
Facundo Batista (community) Approve
Guillermo Gonzalez Approve
Review via email: mp+56627@code.launchpad.net

Commit message

Log the client version at start (LP: #715455).

Description of the change

Log the client version at start.

Test included.

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) :
review: Approve
Revision history for this message
Facundo Batista (facundo) wrote :

Approve with one review.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/syncdaemon/test_main.py'
--- tests/syncdaemon/test_main.py 2011-02-21 20:42:06 +0000
+++ tests/syncdaemon/test_main.py 2011-04-06 17:57:23 +0000
@@ -16,17 +16,24 @@
16# You should have received a copy of the GNU General Public License along16# You should have received a copy of the GNU General Public License along
17# with this program. If not, see <http://www.gnu.org/licenses/>.17# with this program. If not, see <http://www.gnu.org/licenses/>.
18""" Tests for main.Main class """18""" Tests for main.Main class """
19
20import logging
19import os21import os
20import shutil22import shutil
2123
22from twisted.internet import defer, reactor24from twisted.internet import defer, reactor
2325
24from ubuntuone.syncdaemon import main as main_mod26from ubuntuone.syncdaemon import main as main_mod
27from ubuntuone.clientdefs import VERSION
28
25from contrib.testing.testcase import (29from contrib.testing.testcase import (
26 BaseTwistedTestCase, FAKED_CREDENTIALS,30 BaseTwistedTestCase, FAKED_CREDENTIALS,
27)31)
28from tests.platform import setup_main_test, get_main_params32from tests.platform import setup_main_test, get_main_params
2933
34from ubuntuone.devtools.handlers import MementoHandler
35
36
30def _get_main_common_params(testcase):37def _get_main_common_params(testcase):
31 """Return the parameters used by the all platforms."""38 """Return the parameters used by the all platforms."""
32 return dict(root_dir=testcase.root,39 return dict(root_dir=testcase.root,
@@ -60,6 +67,11 @@
60 # perform the extra setup steps according to the platform67 # perform the extra setup steps according to the platform
61 setup_main_test(self)68 setup_main_test(self)
6269
70 self.handler = MementoHandler()
71 self.handler.setLevel(logging.DEBUG)
72 self._logger = logging.getLogger('ubuntuone.SyncDaemon')
73 self._logger.addHandler(self.handler)
74
63 def build_main(self, **kwargs):75 def build_main(self, **kwargs):
64 """76 """
65 Build and return a Main object, using reasonable defaults for77 Build and return a Main object, using reasonable defaults for
@@ -74,6 +86,7 @@
7486
75 def tearDown(self):87 def tearDown(self):
76 """Clean up the tests."""88 """Clean up the tests."""
89 self._logger.removeHandler(self.handler)
77 shutil.rmtree(self.root)90 shutil.rmtree(self.root)
78 shutil.rmtree(self.shares)91 shutil.rmtree(self.shares)
79 shutil.rmtree(self.data)92 shutil.rmtree(self.data)
@@ -289,3 +302,9 @@
289302
290 self.assertEqual(main.get_sharesdir_link(),303 self.assertEqual(main.get_sharesdir_link(),
291 os.path.join(main.get_rootdir(), expected))304 os.path.join(main.get_rootdir(), expected))
305
306 def test_version_is_logged(self):
307 """Test that the client version is logged."""
308 main = self.build_main()
309 self.addCleanup(lambda: main.shutdown())
310 self.assertTrue(self.handler.check_info("client version", VERSION))
292311
=== modified file 'ubuntuone/syncdaemon/main.py'
--- ubuntuone/syncdaemon/main.py 2011-02-21 17:29:02 +0000
+++ ubuntuone/syncdaemon/main.py 2011-04-06 17:57:23 +0000
@@ -36,7 +36,7 @@
36 tritcask,36 tritcask,
37 volume_manager,37 volume_manager,
38)38)
39from ubuntuone import syncdaemon39from ubuntuone import syncdaemon, clientdefs
40import ubuntuone.platform40import ubuntuone.platform
4141
42from ubuntuone.platform import event_logging42from ubuntuone.platform import event_logging
@@ -95,6 +95,8 @@
95 if not throttling_enabled:95 if not throttling_enabled:
96 throttling_enabled = user_config.get_throttling()96 throttling_enabled = user_config.get_throttling()
9797
98 self.logger.info("Starting Ubuntu One client version %s",
99 clientdefs.VERSION)
98 self.db = tritcask.Tritcask(self.tritcask_dir)100 self.db = tritcask.Tritcask(self.tritcask_dir)
99 self.vm = volume_manager.VolumeManager(self)101 self.vm = volume_manager.VolumeManager(self)
100 self.fs = filesystem_manager.FileSystemManager(102 self.fs = filesystem_manager.FileSystemManager(

Subscribers

People subscribed via source and target branches