Skip to content

Commit

Permalink
Updated tests in victorops_test.py to accommodate new fields passed…
Browse files Browse the repository at this point in the history
… to alert payload.

* Needed by #329
  • Loading branch information
ChristophShyper committed Jul 20, 2021
1 parent 4c74ab5 commit 6c30527
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/source/ruletypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2707,7 +2707,7 @@ Optional:

``victorops_entity_id``: The identity of the incident used by Splunk On-Call (Formerly VictorOps) to correlate incidents throughout the alert lifecycle. If not defined, Splunk On-Call (Formerly VictorOps) will assign a random string to each alert.

``victorops_entity_display_name``: Human-readable name of alerting entity to summarize incidents without affecting the life-cycle workflow.
``victorops_entity_display_name``: Human-readable name of alerting entity to summarize incidents without affecting the life-cycle workflow. Will use `alert_subject` if not set.

``victorops_proxy``: By default ElastAlert will not use a network proxy to send notifications to Splunk On-Call (Formerly VictorOps). Set this option using ``hostname:port`` if you need to use a proxy. only supports https.

Expand Down
16 changes: 12 additions & 4 deletions tests/alerters/victorops_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def test_victorops(caplog):
'message_type': rule['victorops_message_type'],
'entity_display_name': rule['victorops_entity_display_name'],
'monitoring_tool': 'ElastAlert',
'state_message': 'Test VictorOps Rule\n\n@timestamp: 2021-01-01T00:00:00\nsomefield: foobarbaz\n'
'state_message': 'Test VictorOps Rule\n\n@timestamp: 2021-01-01T00:00:00\nsomefield: foobarbaz\n',
'@timestamp': '2021-01-01T00:00:00',
'somefield': 'foobarbaz'
}

mock_post_request.assert_called_once_with(
Expand Down Expand Up @@ -76,7 +78,9 @@ def test_victorops_proxy():
'message_type': rule['victorops_message_type'],
'entity_display_name': rule['victorops_entity_display_name'],
'monitoring_tool': 'ElastAlert',
'state_message': 'Test VictorOps Rule\n\n@timestamp: 2021-01-01T00:00:00\nsomefield: foobarbaz\n'
'state_message': 'Test VictorOps Rule\n\n@timestamp: 2021-01-01T00:00:00\nsomefield: foobarbaz\n',
'@timestamp': '2021-01-01T00:00:00',
'somefield': 'foobarbaz'
}

mock_post_request.assert_called_once_with(
Expand Down Expand Up @@ -141,7 +145,9 @@ def test_victorops_entity_id():
'entity_display_name': rule['victorops_entity_display_name'],
'monitoring_tool': 'ElastAlert',
'state_message': 'Test VictorOps Rule\n\n@timestamp: 2021-01-01T00:00:00\nsomefield: foobarbaz\n',
'entity_id': '12345'
'entity_id': '12345',
'@timestamp': '2021-01-01T00:00:00',
'somefield': 'foobarbaz'
}

mock_post_request.assert_called_once_with(
Expand Down Expand Up @@ -186,7 +192,9 @@ def test_victorops_message_type(message_type, except_message_type):
'message_type': except_message_type,
'entity_display_name': rule['victorops_entity_display_name'],
'monitoring_tool': 'ElastAlert',
'state_message': 'Test VictorOps Rule\n\n@timestamp: 2021-01-01T00:00:00\nsomefield: foobarbaz\n'
'state_message': 'Test VictorOps Rule\n\n@timestamp: 2021-01-01T00:00:00\nsomefield: foobarbaz\n',
'@timestamp': '2021-01-01T00:00:00',
'somefield': 'foobarbaz'
}

mock_post_request.assert_called_once_with(
Expand Down

0 comments on commit 6c30527

Please sign in to comment.