~axwalk/charms/trusty/postgresql/trunk

« back to all changes in this revision

Viewing changes to test.py

  • Committer: Stuart Bishop
  • Date: 2013-08-21 16:07:36 UTC
  • mto: (46.13.1 tests) (48.4.4 fix-races)
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: stuart.bishop@canonical.com-20130821160736-kxh3vqatv9x6jer8
Cleanout old code, use more charm helpers, fix unreadable cwd with sudo bug

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
        # enough that our system is probably stable. This means we have
129
129
        # extremely slow and flaky tests, but that is possibly better
130
130
        # than no tests.
131
 
        time.sleep(30)
 
131
        time.sleep(45)
132
132
 
133
133
    def setUp(self):
134
134
        DEBUG("JujuFixture.setUp()")
135
135
        super(JujuFixture, self).setUp()
136
136
        self.reset()
137
 
        self.addCleanup(self.reset)
 
137
        # Optionally, don't teardown services and machines after running
 
138
        # a test. If a subsequent test is run, they will be torn down at
 
139
        # that point. This option is only useful when running a single
 
140
        # test, or when the test harness is set to abort after the first
 
141
        # failed test.
 
142
        if not os.environ.get('TEST_DONT_TEARDOWN_JUJU', False):
 
143
            self.addCleanup(self.reset)
138
144
 
139
145
    def reset(self):
140
146
        DEBUG("JujuFixture.reset()")
286
292
        result = self.sql('SELECT TRUE', dbname='postgres')
287
293
        self.assertEqual(result, [['t']])
288
294
 
289
 
 
290
295
    def is_master(self, postgres_unit, dbname=None):
291
296
        is_master = self.sql(
292
297
            'SELECT NOT pg_is_in_recovery()',