Ejemplo n.º 1
0
    def test_default_hooks(self):
        """Most of the hooks let ansible do all the work."""
        default_hooks = [
            'config-changed',
            'cluster-relation-joined',
            'peer-relation-joined',
            'peer-relation-departed',
            'nrpe-external-master-relation-changed',
            'rest-relation-joined',
            'start',
            'stop',
            'upgrade-charm',
            'client-relation-joined',
            'client-relation-departed',
        ]
        mock_apply_playbook = self.mock_ansible.apply_playbook

        for hook in default_hooks:
            mock_apply_playbook.reset_mock()

            hooks.execute([hook])

            self.assertEqual([
                mock.call('playbook.yaml', tags=[hook]),
            ], mock_apply_playbook.call_args_list)
Ejemplo n.º 2
0
    def test_default_hooks(self):
        """Most of the hooks let ansible do all the work."""
        for hook in ('start', 'stop', 'config-changed'):
            self.mock_apply_playbook.reset_mock()

            hooks.execute([hook])

            self.assertEqual([
                mock.call('playbooks/site.yaml', tags=[hook]),
            ], self.mock_apply_playbook.call_args_list)
Ejemplo n.º 3
0
    def test_default_hooks(self):
        """Most of the hooks let ansible do all the work."""
        for hook in ('start', 'stop', 'config-changed'):
            self.mock_apply_playbook.reset_mock()

            hooks.execute([hook])

            self.assertEqual([
                mock.call('playbooks/site.yaml',
                          tags=[hook]),
            ], self.mock_apply_playbook.call_args_list)
Ejemplo n.º 4
0
    def test_default_hooks(self):
        """Most of the hooks let ansible do all the work."""
        for hook in ('install', 'upgrade-charm', 'config-changed',
                     'website-relation-changed',
                     'wsgi-file-relation-changed'):
            self.mock_apply_playbook.reset_mock()

            hooks.execute([hook])

            self.assertEqual([
                mock.call('playbook.yml',
                          tags=[hook]),
            ], self.mock_apply_playbook.call_args_list)
Ejemplo n.º 5
0
    def test_install_installs_ansible_support(self):
        hooks.execute(['install'])

        ansible = self.mock_charmhelpers.contrib.ansible
        ansible.install_ansible_support.assert_called_once_with(
            from_ppa=True)
Ejemplo n.º 6
0
    def test_applies_install_playbook(self):
        hooks.execute(['install'])

        self.assertEqual([
            mock.call('playbooks/site.yaml', tags=['install']),
        ], self.mock_apply_playbook.call_args_list)
Ejemplo n.º 7
0
    def test_applies_install_playbook(self):
        hooks.execute(['install'])

        self.assertEqual([
            mock.call('playbooks/site.yaml', tags=['install']),
        ], self.mock_apply_playbook.call_args_list)
Ejemplo n.º 8
0
    def test_copys_backported_ansible_modules(self):
        hooks.execute(['install'])

        self.mock_rsync.assert_called_once_with('ansible_module_backports',
                                                '/usr/share/ansible')
Ejemplo n.º 9
0
    def test_executes_preinstall(self):
        hooks.execute(['install'])

        self.mock_preinstall.assert_called_once_with()
Ejemplo n.º 10
0
    def test_installs_ansible_support(self):
        hooks.execute(['install'])

        ansible = self.mock_ansible
        ansible.install_ansible_support.assert_called_once_with(from_ppa=False)