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

Cert monitor alert structure fix #1847

Merged
merged 14 commits into from
Aug 22, 2024
6 changes: 2 additions & 4 deletions service_status/monitor_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
"Team</p></div></body></html>"
CERT_EXP_EMAIL_NOTIFICATION_SUBJ = "Certificates are about to expire for service %s for %s network."
CERT_EXP_SLACK_NOTIFICATION_MSG = \
"```Alert!\n\nCertificates for service %s under organization %s for the %s network are about to expire in %s days.\n" \
"Endpoint: %s \n\nFor any queries please email at [email protected]. \n\nWarmest regards, " \
"\nSingularityNET Marketplace Team```"
"Certificates for service %s under organization %s for the %s network are about to expire in %s days."
NO_OF_ENDPOINT_TO_TEST_LIMIT = 5


Expand Down Expand Up @@ -160,7 +158,7 @@ def _get_certificate_expiration_email_notification_message(org_id, service_id, e

@staticmethod
def _get_certificate_expiration_slack_notification_message(org_id, service_id, endpoint, days_left_for_expiration):
return CERT_EXP_SLACK_NOTIFICATION_MSG % (service_id, org_id, NETWORK_NAME, days_left_for_expiration, endpoint)
return CERT_EXP_SLACK_NOTIFICATION_MSG % (service_id, org_id, NETWORK_NAME, days_left_for_expiration)


class MonitorServiceHealth(MonitorService):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ def test_get_certificate_expiration_slack_notification_message(self):
days_left_for_expiration = 10
response = self.monitor_service_certificate._get_certificate_expiration_slack_notification_message(
org_id=org_id, service_id=service_id, endpoint=endpoint, days_left_for_expiration=days_left_for_expiration)
assert (response == "```Alert!\n\nCertificates for service test_service_id under organization test_org_id for "
"the TEST network are about to expire in 10 days.\nEndpoint: https://dummyendpoint.com \n\n"
"For any queries please email at [email protected]. \n\nWarmest regards, \n"
"SingularityNET Marketplace Team```")
assert (response == "Certificates for service test_service_id under organization test_org_id for "
"the TEST network are about to expire in 10 days.")

def test_get_certificate_expiration_email_notification_message(self):
org_id = "test_org_id"
Expand Down
Loading