def test_service_alive_unavailable(self, mock_get_service_response):
        service = ServiceOpenSearch(self.version, self.additional_config, True,
                                    self.dependency_installer, self.work_dir)

        mock_response = MagicMock()

        mock_response.status_code = 300
        mock_response.text = '"status": "red"'

        mock_get_service_response.return_value = mock_response

        self.assertFalse(service.service_alive())
Example #2
0
    def test_service_alive_yellow_available(self, mock_get_service_response: Mock) -> None:
        service = ServiceOpenSearch(
            self.version,
            self.distribution,
            self.additional_config,
            True,
            self.dependency_installer,
            self.work_dir
        )

        mock_response = MagicMock()

        mock_response.status_code = 200
        mock_response.text = '"status":"yellow"'

        mock_get_service_response.return_value = mock_response

        self.assertTrue(service.service_alive())