-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from idealista/develop
Develop v1.1.3
- Loading branch information
Showing
10 changed files
with
161 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"receiver": "test_webhook", | ||
"status": "resolved", | ||
"alerts": [ | ||
{ | ||
"status": "resolved", | ||
"labels": { | ||
"alertname": "DiskSpace", | ||
"device": "rootfs", | ||
"fstype": "rootfs", | ||
"instance": "cs30.evilcorp", | ||
"job": "fsociety", | ||
"mountpoint": "/", | ||
"severity": "severe" | ||
}, | ||
"annotations": { | ||
"description": "disk usage 73% on rootfs device", | ||
"summary": "Disk usage alert on CS30.evilcorp" | ||
}, | ||
"startsAt": "2017-05-09T07:01:37.803Z", | ||
"endsAt": "2017-05-09T07:08:37.818278068Z", | ||
"generatorURL": "my.prometheusserver.url" | ||
} | ||
], | ||
"externalURL": "my.prometheusalertmanager.url", | ||
"version": "4" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"receiver": "test_webhook", | ||
"alerts": [ | ||
{ | ||
"labels": { | ||
"alertname": "DiskSpace", | ||
"device": "rootfs", | ||
"fstype": "rootfs", | ||
"instance": "cs30.evilcorp", | ||
"job": "fsociety", | ||
"mountpoint": "/", | ||
"severity": "severe" | ||
}, | ||
"annotations": { | ||
"description": "disk usage 73% on rootfs device", | ||
"summary": "Disk usage alert on CS30.evilcorp" | ||
}, | ||
"startsAt": "2017-05-09T07:01:37.803Z", | ||
"endsAt": "2017-05-09T07:08:37.818278068Z", | ||
"generatorURL": "my.prometheusserver.url" | ||
} | ||
], | ||
"externalURL": "my.prometheusalertmanager.url", | ||
"version": "4" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"receiver": "test_webhook", | ||
"status": "resolved", | ||
"alerts": [ | ||
{ | ||
"status": "resolved", | ||
"labels": { | ||
"alertname": "DiskSpace", | ||
"device": "rootfs", | ||
"fstype": "rootfs", | ||
"instance": "cs30.evilcorp", | ||
"job": "fsociety", | ||
"mountpoint": "/", | ||
"severity": "severe" | ||
}, | ||
"annotations": { | ||
"summary": "Disk usage alert on CS30.evilcorp" | ||
}, | ||
"startsAt": "2017-05-09T07:01:37.803Z", | ||
"endsAt": "2017-05-09T07:08:37.818278068Z", | ||
"generatorURL": "my.prometheusserver.url" | ||
} | ||
], | ||
"externalURL": "my.prometheusalertmanager.url", | ||
"version": "4" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import unittest | ||
import json | ||
|
||
from context import parse | ||
|
||
|
||
class TestJSONFields(unittest.TestCase): | ||
|
||
TEST_CONFIG_FILES_PATH = 'tests/data/jsons/' | ||
|
||
def test_json_with_all_fields(self): | ||
with open(self.TEST_CONFIG_FILES_PATH + 'all_ok.json') as json_data: | ||
json_received = json.load(json_data) | ||
alert_fields = parse(json.dumps(json_received)) | ||
self.assertNotIn('Incorrect',str(alert_fields)) | ||
|
||
def test_json_without_mandatory_field(self): | ||
with open(self.TEST_CONFIG_FILES_PATH + 'without_mandatory_field.json') as json_data: | ||
json_received = json.load(json_data) | ||
alert_fields = parse(json.dumps(json_received)) | ||
self.assertIn('Incorrect',str(alert_fields)) | ||
|
||
def test_json_without_optional_field(self): | ||
with open(self.TEST_CONFIG_FILES_PATH + 'without_optional_field.json') as json_data: | ||
json_received = json.load(json_data) | ||
alert_fields = parse(json.dumps(json_received)) | ||
self.assertNotIn('Incorrect',str(alert_fields)) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |