Exemplo n.º 1
0
    def test__clone_resource__happy(self, has_type,
                                    clone_resource_expected_count,
                                    clone_resource_current_count):

        mod_cls = create_autospec(AnsibleModule)
        mod = mod_cls.return_value
        mod.params = dict(resource="haproxy", max_wait="5")

        has_type.return_value = pacemaker_is_active.Clone(mod, 'haproxy')
        clone_resource_expected_count.return_value = 3
        clone_resource_current_count.return_value = 3
        pacemaker_is_active.is_resource_active(mod)
        self.assertEqual(0, mod.fail_json.call_count)
        self.assertEqual(1, mod.exit_json.call_count)
Exemplo n.º 2
0
 def test__clone__happy_path(self, mod, check_output):
     check_output.return_value = (0,
                                  MyTestUtils.cib_file_to_string(GOOD_CIB),
                                  '')
     count = pacemaker_is_active.Clone(mod, 'haproxy').current_count()
     self.assertEqual(count, 3)
Exemplo n.º 3
0
 def test__clone__catch_error_pre_c_HA2(self, mod, check_output,
                                        _pipe_no_shell):
     check_output.return_value = (6, '', '')
     _pipe_no_shell.return_value = ["2\n", None]
     count = pacemaker_is_active.Clone(mod, 'haproxy').expected_count()
     self.assertEqual(count, 2)
Exemplo n.º 4
0
 def test__clone__catch_error_pre_cp_HA(self, mod, check_output,
                                        _pipe_no_shell):
     check_output.return_value = (6, '', 'Err')
     _pipe_no_shell.side_effect = [["0\n", None], ["\n3\n", None]]
     count = pacemaker_is_active.Clone(mod, 'haproxy').expected_count()
     self.assertEqual(count, 3)
Exemplo n.º 5
0
 def test__clone__happy_path(self, mod, check_output):
     check_output.return_value = (0, "3\n", '')
     count = pacemaker_is_active.Clone(mod, 'haproxy').expected_count()
     self.assertEqual(count, 3)