← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~bac/launchpad/bug-981114-2 into lp:launchpad

 

Brad Crittenden has proposed merging lp:~bac/launchpad/bug-981114-2 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #981114 in Launchpad itself: "LP tests fail in lxc due to 'bzr whoami' failure"
  https://bugs.launchpad.net/launchpad/+bug/981114

For more details, see:
https://code.launchpad.net/~bac/launchpad/bug-981114-2/+merge/103342

= Summary =

Some tests fail if 'bzr whoami' cannot construct a name.  The previous
approach was to have /etc/mailname written by setuplxc.  Instead, we
explicitly set 'bzr whoami' in the tests that need it.

== Proposed fix ==

Invoke 'bzr whoami' in the one necessary test.

== Pre-implementation notes ==

Talks with Robert and Gary.

== Implementation details ==

As above.

== Tests ==

bin/test -vvt Celery seems to hit them all.

== Demo and Q/A ==

N/A

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  utilities/setuplxc.py
  lib/lp/codehosting/scanner/tests/test_email.py
-- 
https://code.launchpad.net/~bac/launchpad/bug-981114-2/+merge/103342
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/launchpad/bug-981114-2 into lp:launchpad.
=== modified file 'lib/lp/codehosting/scanner/tests/test_email.py'
--- lib/lp/codehosting/scanner/tests/test_email.py	2012-04-12 19:50:44 +0000
+++ lib/lp/codehosting/scanner/tests/test_email.py	2012-04-24 18:23:31 +0000
@@ -8,6 +8,7 @@
 import email
 
 from bzrlib.uncommit import uncommit
+import os
 from zope.component import getUtility
 from zope.event import notify
 
@@ -172,6 +173,8 @@
         switch_dbuser(config.branchscanner.dbuser)
         # Needed for feature flag teardown
         self.addCleanup(switch_dbuser, config.launchpad.dbuser)
+        # Set 'bzr whoami' for proper test isolation.  (See bug 981114).
+        os.system("bzr whoami 'Nobody Knows <nobody@xxxxxxxxxxx>'")
         return db_branch, tree
 
     def test_empty_branch(self):

=== modified file 'utilities/setuplxc.py'
--- utilities/setuplxc.py	2012-04-20 08:52:15 +0000
+++ utilities/setuplxc.py	2012-04-24 18:23:31 +0000
@@ -60,7 +60,6 @@
     'python-shelltoolbox', 'subunit',
     ]
 HOSTS_FILE = '/etc/hosts'
-MAILNAME_FILE = '/etc/mailname'
 LP_APACHE_MODULES = 'proxy proxy_http rewrite ssl deflate headers'
 LP_APACHE_ROOTS = (
     '/var/tmp/bazaar.launchpad.dev/static',
@@ -1121,13 +1120,6 @@
     # ephemeral container
     root_sshcall('mkdir -p /rootfs/usr/lib')
     root_sshcall('ln -s /usr/lib/graphviz /rootfs/usr/lib/graphviz')
-    # XXX: BradCrittenden 2012-04-13 bug=981114: Manually create /etc/mailname
-    # or bzrlib gets upset and returns None,None for whoami causing test
-    # failures.
-    mailname_file = get_container_path(lxcname, MAILNAME_FILE)
-    if not os.path.exists(mailname_file):
-        with open(mailname_file, 'w') as fd:
-            fd.write('localhost')
 
 
 def stop_lxc(lxcname, ssh_key_path):


Follow ups