celery: add task for triggering link tests

We want to periodically kick off some link tests, so that:

- we are periodically communicating with the CBC Proxies
- each CBC Proxy is periodically communicating with its CBC

This simulation of traffic to the CBC will give us advance warning if
something is going to break, or is broken, before someone tries to send
a real live message

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: Richard <richard.baker@digital.cabinet-office.gov.uk>
Co-authored-by: Pea <pea.tyczynska@digital.cabinet-office.gov.uk>
This commit is contained in:
Toby Lorne
2020-10-27 15:39:28 +00:00
parent 7542709455
commit dda71bf685
3 changed files with 46 additions and 0 deletions

View File

@@ -575,3 +575,22 @@ def test_send_canary_to_cbc_proxy_invokes_cbc_proxy_client(
uuid.UUID(identifier)
except BaseException:
pytest.fail(f"{identifier} is not a valid uuid")
def test_trigger_link_tests_invokes_cbc_proxy_client(
mocker,
):
mock_send_link_test = mocker.patch(
'app.cbc_proxy_client.send_link_test',
)
scheduled_tasks.trigger_link_tests()
mock_send_link_test.assert_called
# the 0th argument of the call to send_link_test
identifier = mock_send_link_test.mock_calls[0][1][0]
try:
uuid.UUID(identifier)
except BaseException:
pytest.fail(f"{identifier} is not a valid uuid")