~wgrant/ubuntu/natty/landscape-client/natty-updates-broken

« back to all changes in this revision

Viewing changes to landscape/tests/test_watchdog.py

  • Committer: Bazaar Package Importer
  • Author(s): Christopher Armstrong
  • Date: 2009-04-09 17:09:50 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090409170950-mc5mqadawk0ls2vc
Tags: 1.0.29-0ubuntu0.9.04.0
* New upstream bugfix release (LP: #358744)
  - Add a timeout to HTTP operations to avoid hanging (LP: #349737)
  - Clean up environment variables on startup to avoid propagating
    variables that will corrupt package installation (LP: #348681)
  - Clean up FDs on startup for the same reason (LP: #352458)
  - Catch and handle certain errors from smart (such as invalid package
    data) to avoid "stuck" Landscape activities (LP: #268745)
  - Don't print warnings meant for developers to the console (LP: #336669)

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
from landscape.tests.mocker import ARGS, KWARGS
16
16
from landscape.tests.clock import Clock
17
17
from landscape.tests.helpers import (
18
 
    LandscapeIsolatedTest, LandscapeTest, DBusHelper, RemoteBrokerHelper)
 
18
    LandscapeIsolatedTest, LandscapeTest, DBusHelper, RemoteBrokerHelper,
 
19
    EnvironSaverHelper)
19
20
from landscape.watchdog import (
20
21
    Daemon, WatchDog, WatchDogService, ExecutableNotFoundError,
21
22
    WatchDogConfiguration, bootstrap_list,
1268
1269
 
1269
1270
 
1270
1271
class WatchDogRunTests(LandscapeTest):
 
1272
    helpers = [EnvironSaverHelper]
 
1273
 
1271
1274
    def setUp(self):
1272
1275
        super(WatchDogRunTests, self).setUp()
1273
1276
        self.addCleanup(setattr, WatchDogConfiguration,
1303
1306
            reactor=reactor)
1304
1307
        self.assertTrue(reactor.running)
1305
1308
 
 
1309
    def test_clean_environment(self):
 
1310
        os.environ["DEBIAN_YO"] = "yo"
 
1311
        os.environ["DEBCONF_YO"] = "yo"
 
1312
        os.environ["LANDSCAPE_ATTACHMENTS"] = "some attachments"
 
1313
        os.environ["UNRELATED"] = "unrelated"
 
1314
 
 
1315
        reactor = FakeReactor()
 
1316
        run(["--bus", "session", "--log-dir", self.make_path()],
 
1317
            reactor=reactor)
 
1318
        self.assertNotIn("DEBIAN_YO", os.environ)
 
1319
        self.assertNotIn("DEBCONF_YO", os.environ)
 
1320
        self.assertNotIn("LANDSCAPE_ATTACHMENTS", os.environ)
 
1321
        self.assertEquals(os.environ["UNRELATED"], "unrelated")