Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Arpit Bandejiya <[email protected]>
  • Loading branch information
Arpit-Bandejiya committed Oct 14, 2022
1 parent 850ba65 commit 08a58ad
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/worker_coordinator/runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 08a58ad

Please sign in to comment.