Remove the emergency alerts canary

See https://github.com/alphagov/notifications-broadcasts-infra/pull/197
for why we no longer need this and we get to delete some code!
This commit is contained in:
David McDonald
2021-03-26 18:25:41 +00:00
parent 47c2ced614
commit 6d410daae4
5 changed files with 1 additions and 111 deletions

View File

@@ -1,4 +1,3 @@
import uuid
from collections import namedtuple
from datetime import datetime, timedelta
from unittest.mock import call
@@ -600,39 +599,6 @@ def test_check_for_services_with_high_failure_rates_or_sending_to_tv_numbers(
)
def test_send_canary_to_cbc_proxy_invokes_cbc_proxy_client(
mocker,
notify_api
):
mock_send_canary = mocker.patch(
'app.clients.cbc_proxy.CBCProxyCanary.send_canary',
)
scheduled_tasks.send_canary_to_cbc_proxy()
assert mock_send_canary.called is True
# the 0th argument of the call to send_canary
identifier = mock_send_canary.mock_calls[0][1][0]
try:
uuid.UUID(identifier)
except BaseException:
pytest.fail(f"{identifier} is not a valid uuid")
def test_send_canary_to_cbc_proxy_does_nothing_if_cbc_proxy_disabled(
mocker, notify_api
):
mock_send_canary = mocker.patch(
'app.clients.cbc_proxy.CBCProxyCanary.send_canary',
)
with set_config(notify_api, 'CBC_PROXY_ENABLED', False):
scheduled_tasks.send_canary_to_cbc_proxy()
assert mock_send_canary.called is False
def test_trigger_link_tests_calls_for_all_providers(
mocker, notify_api
):

View File

@@ -9,7 +9,6 @@ import pytest
from botocore.exceptions import ClientError as BotoClientError
from app.clients.cbc_proxy import (
CBCProxyCanary,
CBCProxyClient,
CBCProxyEE,
CBCProxyO2,
@@ -58,7 +57,6 @@ def cbc_proxy_vodafone(cbc_proxy_client):
('three', CBCProxyThree),
('o2', CBCProxyO2),
('vodafone', CBCProxyVodafone),
('canary', CBCProxyCanary),
])
def test_cbc_proxy_client_returns_correct_client(provider_name, expected_provider_class):
mock_lambda = Mock()
@@ -557,38 +555,6 @@ def test_cbc_proxy_create_and_send_tries_failover_lambda_on_function_error_and_r
]
def test_cbc_proxy_send_canary_invokes_function(mocker, cbc_proxy_client):
identifier = str(uuid.uuid4())
canary_client = cbc_proxy_client.get_proxy('canary')
ld_client_mock = mocker.patch.object(
canary_client,
'_lambda_client',
create=True,
)
ld_client_mock.invoke.return_value = {
'StatusCode': 200,
}
canary_client.send_canary(
identifier=identifier,
)
ld_client_mock.invoke.assert_called_once_with(
FunctionName='canary',
InvocationType='RequestResponse',
Payload=mocker.ANY,
)
kwargs = ld_client_mock.invoke.mock_calls[0][-1]
payload_bytes = kwargs['Payload']
payload = json.loads(payload_bytes)
assert payload['identifier'] == identifier
@pytest.mark.parametrize('cbc', ['ee', 'three', 'o2'])
def test_cbc_proxy_one_2_many_send_link_test_invokes_function(mocker, cbc_proxy_client, cbc):
cbc_proxy = cbc_proxy_client.get_proxy(cbc)