2d03dc773b
* Alert Plugin Signed-off-by: Arnav Das <arnav.das88@gmail.com> * lint file header license Signed-off-by: Arnav Das <arnav.das88@gmail.com> * Tests For Alerting[Monitors] Signed-off-by: Arnav Das <arnav.das88@gmail.com> * Tests For Alerting[Destinations] Signed-off-by: Arnav Das <arnav.das88@gmail.com> * dynamic lookup 90#issuecomment-1003396742 Signed-off-by: Arnav Das <arnav.das88@gmail.com> * Alerting Async Signed-off-by: Arnav Das <arnav.das88@gmail.com> * Lint Changes Signed-off-by: Arnav Das <arnav.das88@gmail.com> * alerting plugins integration tests Signed-off-by: Arnav Das <arnav.das88@gmail.com> * Integ UnitTests Skip on OPENSEARCH_VERSION >= 2.0.0 Signed-off-by: Arnav Das <arnav.das88@gmail.com> * Unit Test Skip Complete Signed-off-by: Arnav Das <arnav.das88@gmail.com> * License Headers fixed Signed-off-by: Arnav Das <arnav.das88@gmail.com> * test_urllib3_connection timeout Signed-off-by: Arnav Das <arnav.das88@gmail.com> * lint Signed-off-by: Arnav Das <arnav.das88@gmail.com> * Fix licenses in all files Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> * Remove elastic search licenses on new files Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> * Fix formatting Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> Signed-off-by: Arnav Das <arnav.das88@gmail.com> Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> Co-authored-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
78 lines
2.8 KiB
Python
78 lines
2.8 KiB
Python
# 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.
|
|
|
|
from test_opensearchpy.test_cases import OpenSearchTestCase
|
|
|
|
|
|
class TestAlerting(OpenSearchTestCase):
|
|
def test_create_monitor(self):
|
|
# Test Post Method
|
|
self.client.alerting.create_monitor({})
|
|
self.assert_url_called("POST", "/_plugins/_alerting/monitors")
|
|
|
|
def test_run_monitor(self):
|
|
self.client.alerting.run_monitor("...")
|
|
self.assert_url_called("POST", "/_plugins/_alerting/monitors/.../_execute")
|
|
|
|
def test_get_monitor(self):
|
|
# Test Get Method
|
|
self.client.alerting.get_monitor("...")
|
|
self.assert_url_called("GET", "/_plugins/_alerting/monitors/...")
|
|
|
|
def test_search_monitor(self):
|
|
# Test Search Method
|
|
self.client.alerting.search_monitor({})
|
|
self.assert_url_called("GET", "/_plugins/_alerting/monitors/_search")
|
|
|
|
def test_update_monitor(self):
|
|
# Test Update Method
|
|
self.client.alerting.update_monitor("...")
|
|
self.assert_url_called("PUT", "/_plugins/_alerting/monitors/...")
|
|
|
|
def test_delete_monitor(self):
|
|
# Test Delete Method
|
|
self.client.alerting.delete_monitor("...")
|
|
self.assert_url_called("DELETE", "/_plugins/_alerting/monitors/...")
|
|
|
|
def test_create_destination(self):
|
|
# Test Post Method
|
|
self.client.alerting.create_destination({})
|
|
self.assert_url_called("POST", "/_plugins/_alerting/destinations")
|
|
|
|
def test_get_destination(self):
|
|
# Test Get Method
|
|
|
|
# Get a specific destination
|
|
self.client.alerting.get_destination("...")
|
|
self.assert_url_called("GET", "/_plugins/_alerting/destinations/...")
|
|
|
|
# Get all destinations
|
|
self.client.alerting.get_destination()
|
|
self.assert_url_called("GET", "/_plugins/_alerting/destinations")
|
|
|
|
def test_update_destination(self):
|
|
# Test Update Method
|
|
self.client.alerting.update_destination("...")
|
|
self.assert_url_called("PUT", "/_plugins/_alerting/destinations/...")
|
|
|
|
def test_delete_destination(self):
|
|
# Test Delete Method
|
|
self.client.alerting.delete_destination("...")
|
|
self.assert_url_called("DELETE", "/_plugins/_alerting/destinations/...")
|
|
|
|
def test_get_alerts(self):
|
|
self.client.alerting.get_alerts()
|
|
self.assert_url_called("GET", "/_plugins/_alerting/monitors/alerts")
|
|
|
|
def test_acknowledge_alerts(self):
|
|
self.client.alerting.acknowledge_alert("...")
|
|
self.assert_url_called(
|
|
"POST", "/_plugins/_alerting/monitors/.../_acknowledge/alerts"
|
|
)
|