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
1=== modified file 'tests/syncdaemon/test_main.py'
2--- tests/syncdaemon/test_main.py 2011-02-21 20:42:06 +0000
3+++ tests/syncdaemon/test_main.py 2011-04-06 17:57:23 +0000
4@@ -16,17 +16,24 @@
5 # You should have received a copy of the GNU General Public License along
6 # with this program. If not, see <http://www.gnu.org/licenses/>.
7 """ Tests for main.Main class """
8+
9+import logging
10 import os
11 import shutil
12
13 from twisted.internet import defer, reactor
14
15 from ubuntuone.syncdaemon import main as main_mod
16+from ubuntuone.clientdefs import VERSION
17+
18 from contrib.testing.testcase import (
19 BaseTwistedTestCase, FAKED_CREDENTIALS,
20 )
21 from tests.platform import setup_main_test, get_main_params
22
23+from ubuntuone.devtools.handlers import MementoHandler
24+
25+
26 def _get_main_common_params(testcase):
27 """Return the parameters used by the all platforms."""
28 return dict(root_dir=testcase.root,
29@@ -60,6 +67,11 @@
30 # perform the extra setup steps according to the platform
31 setup_main_test(self)
32
33+ self.handler = MementoHandler()
34+ self.handler.setLevel(logging.DEBUG)
35+ self._logger = logging.getLogger('ubuntuone.SyncDaemon')
36+ self._logger.addHandler(self.handler)
37+
38 def build_main(self, **kwargs):
39 """
40 Build and return a Main object, using reasonable defaults for
41@@ -74,6 +86,7 @@
42
43 def tearDown(self):
44 """Clean up the tests."""
45+ self._logger.removeHandler(self.handler)
46 shutil.rmtree(self.root)
47 shutil.rmtree(self.shares)
48 shutil.rmtree(self.data)
49@@ -289,3 +302,9 @@
50
51 self.assertEqual(main.get_sharesdir_link(),
52 os.path.join(main.get_rootdir(), expected))
53+
54+ def test_version_is_logged(self):
55+ """Test that the client version is logged."""
56+ main = self.build_main()
57+ self.addCleanup(lambda: main.shutdown())
58+ self.assertTrue(self.handler.check_info("client version", VERSION))
59
60=== modified file 'ubuntuone/syncdaemon/main.py'
61--- ubuntuone/syncdaemon/main.py 2011-02-21 17:29:02 +0000
62+++ ubuntuone/syncdaemon/main.py 2011-04-06 17:57:23 +0000
63@@ -36,7 +36,7 @@
64 tritcask,
65 volume_manager,
66 )
67-from ubuntuone import syncdaemon
68+from ubuntuone import syncdaemon, clientdefs
69 import ubuntuone.platform
70
71 from ubuntuone.platform import event_logging
72@@ -95,6 +95,8 @@
73 if not throttling_enabled:
74 throttling_enabled = user_config.get_throttling()
75
76+ self.logger.info("Starting Ubuntu One client version %s",
77+ clientdefs.VERSION)
78 self.db = tritcask.Tritcask(self.tritcask_dir)
79 self.vm = volume_manager.VolumeManager(self)
80 self.fs = filesystem_manager.FileSystemManager(

Subscribers

People subscribed via source and target branches