~stub/charms/trusty/cassandra-tools/devel

« back to all changes in this revision

Viewing changes to tests/test_actions.py

  • Committer: Stuart Bishop
  • Date: 2015-06-24 13:00:08 UTC
  • Revision ID: stuart.bishop@canonical.com-20150624130008-dmlgy4rjvkouidlf
wip

Show diffs side-by-side

added added

removed removed

Lines of Context:
578
578
    @patch('charmhelpers.core.host.service_start')
579
579
    @patch('helpers.status_set')
580
580
    @patch('helpers.actual_seed_ips')
 
581
    @patch('helpers.get_seed_ips')
581
582
    @patch('relations.StorageRelation.needs_remount')
582
583
    @patch('helpers.is_bootstrapped')
583
584
    @patch('helpers.is_cassandra_running')
584
585
    @patch('helpers.is_decommissioned')
585
586
    def test_needs_restart(self, is_decom, is_running, is_bootstrapped,
586
 
                           needs_remount, seed_ips, status_set, service_start):
 
587
                           needs_remount, seed_ips, actual_seeds,
 
588
                           status_set, service_start):
587
589
        is_decom.return_value = False
588
590
        is_running.return_value = True
589
591
        needs_remount.return_value = False
590
592
        seed_ips.return_value = set(['1.2.3.4'])
 
593
        actual_seeds.return_value = set(['1.2.3.4'])
591
594
 
592
595
        config = hookenv.config()
593
596
        config['configured_seeds'] = list(sorted(seed_ips()))
631
634
 
632
635
        # If the seeds have changed, we need to restart.
633
636
        seed_ips.return_value = set(['9.8.7.6'])
 
637
        actual_seeds.return_value = set(['9.8.7.6'])
634
638
        self.assertTrue(actions.needs_restart())
 
639
        is_running.side_effect = iter([False, True])
635
640
        helpers.start_cassandra()
 
641
        is_running.side_effect = None
 
642
        is_running.return_value = True
636
643
        self.assertFalse(actions.needs_restart())
637
644
 
638
645
    @patch('charmhelpers.core.hookenv.is_leader')