Example #1
0
    def test_all(self, mock_class):
        """Function:  test_all

        Description:  Test with all option.

        Arguments:

        """

        mock_class.return_value = ElasticSearchStatus(self.els.hosts,
                                                      self.els.port, self.mem,
                                                      self.cpu, self.disk)

        self.assertFalse(
            elastic_db_admin.check_status(self.els,
                                          check_call=self.check_call,
                                          args_array=self.args_array5,
                                          cfg=self.cfg2))
Example #2
0
    def test_default_no_error(self, mock_class):
        """Function:  test_default_no_error

        Description:  Test with default option and no errors.

        Arguments:

        """

        mock_class.return_value = ElasticSearchStatus(self.els.hosts,
                                                      self.els.port, self.mem,
                                                      self.cpu, self.disk)

        self.assertFalse(
            elastic_db_admin.check_status(self.els,
                                          check_call=self.check_call,
                                          args_array={},
                                          cfg=self.cfg2))
Example #3
0
    def test_one_option_cfg(self, mock_class):
        """Function:  test_one_option_cfg

        Description:  Test config settings.

        Arguments:

        """

        mock_class.return_value = ElasticSearchStatus(self.els.hosts,
                                                      self.els.port, self.mem,
                                                      self.cpu, self.disk)

        self.assertFalse(
            elastic_db_admin.check_status(self.els,
                                          check_call=self.check_call,
                                          args_array=self.args_array6,
                                          cfg=self.cfg))
Example #4
0
    def test_cutoff_args(self, mock_class):
        """Function:  test_cutoff_args

        Description:  Test passing in cutoff arguments.

        Arguments:

        """

        mock_class.return_value = ElasticSearchStatus(self.els.hosts,
                                                      self.els.port, self.mem,
                                                      self.cpu, self.disk)

        self.assertFalse(
            elastic_db_admin.check_status(self.els,
                                          check_call=self.check_call,
                                          args_array=self.args_array8,
                                          cfg=self.cfg))
Example #5
0
    def test_all_with_error(self, mock_class):
        """Function:  test_all_with_error

        Description:  Test with all option and with error.

        Arguments:

        """
        els = ElasticSearchStatus(self.els.hosts, self.els.port, self.mem,
                                  self.cpu, self.disk)
        els.all_err_msg = "Error Message"
        mock_class.return_value = els

        with gen_libs.no_std_out():
            self.assertFalse(
                elastic_db_admin.check_status(self.els,
                                              check_call=self.check_call,
                                              args_array=self.args_array,
                                              cfg=self.cfg2))
Example #6
0
    def test_incorrect_option(self, mock_class):
        """Function:  test_incorrect_option

        Description:  Test with incorrect option.

        Arguments:

        """

        mock_class.return_value = ElasticSearchStatus(self.els.hosts,
                                                      self.els.port, self.mem,
                                                      self.cpu, self.disk)

        with gen_libs.no_std_out():
            self.assertFalse(
                elastic_db_admin.check_status(self.els,
                                              check_call=self.check_call,
                                              args_array=self.args_array7,
                                              cfg=self.cfg2))
Example #7
0
    def test_one_option_error(self, mock_class):
        """Function:  test_one_option_error

        Description:  Test with one option with error.

        Arguments:

        """

        els = ElasticSearchStatus(self.els.hosts, self.els.port, self.mem,
                                  self.cpu, self.disk)
        els.mem_err_msg = {"Err": "Error Message"}
        els.cluster_err_msg = {}
        mock_class.return_value = els

        with gen_libs.no_std_out():
            self.assertFalse(
                elastic_db_admin.check_status(self.els,
                                              check_call=self.check_call,
                                              args_array=self.args_array6,
                                              cfg=self.cfg2))