~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-09-10 07:22:22 UTC
  • Revision ID: stuart.bishop@canonical.com-20150910072222-vhi0qt5jsr0hsl50
Allow admin connections access to cluster communication ports, for tools such as sstableloader

Show diffs side-by-side

added added

removed removed

Lines of Context:
844
844
    @patch('charmhelpers.core.hookenv.relations_of_type')
845
845
    @patch('actions.ufw')
846
846
    def test_configure_firewall(self, ufw, rel_of_type):
847
 
        rel_of_type.return_value = [{'private-address': '1.1.0.1'},
848
 
                                    {'private-address': '1.1.0.2'}]
849
 
 
 
847
        rel_of_type.side_effect = iter([[{'private-address': '1.1.0.1'},
 
848
                                         {'private-address': '1.1.0.2'}],
 
849
                                        []])
850
850
        actions.configure_firewall('')
851
851
 
852
852
        # Confirm our mock provided the expected data.
853
 
        rel_of_type.assert_called_once_with('cluster')
 
853
        rel_of_type.assert_has_calls([call('cluster'), call('database-admin')])
854
854
 
855
855
        ufw.enable.assert_called_once_with(soft_fail=True)  # Always enabled.
856
856
 
883
883
        config['open_client_ports'] = True
884
884
        ufw.reset_mock()
885
885
 
 
886
        rel_of_type.side_effect = iter([[],
 
887
                                        [{'private-address': '1.1.0.1'},
 
888
                                         {'private-address': '1.1.0.2'}]])
886
889
        actions.configure_firewall('')
887
890
 
888
891
        # Three ports now globally open. Yes, having the globally open