Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix point in time rest api #191

Merged
merged 12 commits into from
Nov 2, 2022
Prev Previous commit
Next Next commit
Add Unit tests
Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
  • Loading branch information
Arpit-Bandejiya committed Aug 23, 2022
commit fdd2e9d159c2e11debb27bcc554e0f60388998b0
46 changes: 46 additions & 0 deletions test_opensearchpy/test_client/test_point_in_time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
Arpit-Bandejiya marked this conversation as resolved.
Show resolved Hide resolved
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

from test_opensearchpy.test_cases import OpenSearchTestCase


class TestPointInTime(OpenSearchTestCase):
def test_create_one_point_in_time(self):
index_name = "test-index"
self.client.create_point_in_time(index=index_name)
self.assert_url_called("POST", "/test-index/_search/point_in_time")

def test_delete_one_point_in_time(self):
self.client.delete_point_in_time(body={})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not call delete with empty body . its delete all or delete with list of pit ids in empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, have updated it in the new revision. Thanks!

self.assert_url_called("DELETE", "/_search/point_in_time")

def test_delete_all_point_in_time(self):
self.client.delete_point_in_time(body={}, all="_all")
self.assert_url_called("DELETE", "/_search/point_in_time/_all")

def test_list_all_point_in_time(self):
self.client.list_all_point_in_time()
self.assert_url_called("GET", "/_search/point_in_time/all")