From 6f9657746d86945664a34bf87b6a16713c7b9370 Mon Sep 17 00:00:00 2001 From: hejunli Date: Mon, 29 Aug 2022 11:06:17 +0800 Subject: [PATCH] Add a test case for typical_logs You can test no index status by using this test. Change-Id: I7f82be480901ccfb2e526157ffbc11229de166a5 --- venus/tests/unit/api/test_search_action.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/venus/tests/unit/api/test_search_action.py b/venus/tests/unit/api/test_search_action.py index e4f93a1..28f232b 100644 --- a/venus/tests/unit/api/test_search_action.py +++ b/venus/tests/unit/api/test_search_action.py @@ -508,6 +508,18 @@ class TestSearchAction(unittest.TestCase): 'interval_en': '30minutes'}} self.assertEqual(expected, result) + def test_typical_logs_no_index(self): + action = SearchCore() + expected = {"code": 0, "msg": "no data, no index"} + result = action.typical_logs('error_stats', '2', '1') + self.assertEqual(expected, result) + result = action.typical_logs('rabbitmq_error_stats', '2', '1') + self.assertEqual(expected, result) + result = action.typical_logs('mysql_error_stats', '2', '1') + self.assertEqual(expected, result) + result = action.typical_logs('novalidhost_error_stats', '2', '1') + self.assertEqual(expected, result) + if __name__ == "__main__": unittest.main()