From 08a58ad0f6201c84ca821a3b4abb5320b1ccfef2 Mon Sep 17 00:00:00 2001 From: Arpit Bandejiya Date: Fri, 14 Oct 2022 15:21:10 +0530 Subject: [PATCH] Add tests Signed-off-by: Arpit Bandejiya --- tests/worker_coordinator/runner_test.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/worker_coordinator/runner_test.py b/tests/worker_coordinator/runner_test.py index 27523dd88..210533723 100644 --- a/tests/worker_coordinator/runner_test.py +++ b/tests/worker_coordinator/runner_test.py @@ -4403,7 +4403,7 @@ async def test_creates_point_in_time(self, opensearch): "index": "test-index" } - opensearch.create_point_in_time.return_value = as_future({"id": pit_id}) + opensearch.create_point_in_time.return_value = as_future({"pit_id": pit_id}) r = runner.CreatePointInTime() async with runner.CompositeContext(): @@ -4419,7 +4419,7 @@ async def test_can_only_be_run_in_composite(self, opensearch): "index": "test-index" } - opensearch.create_point_in_time.return_value = as_future({"id": pit_id}) + opensearch.create_point_in_time.return_value = as_future({"pit_id": pit_id}) r = runner.CreatePointInTime() with self.assertRaises(exceptions.BenchmarkAssertionError) as ctx: @@ -4444,6 +4444,17 @@ async def test_delete_point_in_time(self, opensearch): opensearch.delete_point_in_time.assert_called_once_with(body={"pit_id": ["0123456789abcdef"]}, params={}, headers=None) + @mock.patch("opensearchpy.OpenSearch") + @run_async + async def test_delete_point_in_time_without_context(self, opensearch): + params = { + "name": "close-pit-test", + } + opensearch.delete_point_in_time.return_value=(as_future()) + r = runner.DeletePointInTime() + await r(opensearch, params) + opensearch.delete_point_in_time.assert_called_once_with(body=None, all=True, params={}, headers=None) + class ListAllPointInTimeTests(TestCase): @mock.patch("opensearchpy.OpenSearch") @run_async