Commit Graph

27 Commits

Author SHA1 Message Date
Ben Thorner
05bd26d444 Fix names for a few tests in test_nightly_tasks.py
I find it really difficult to visually parse test files unless we
have a consistent convention for how we name our test functions.
In most of our tests the name of the test function starts with the
name of the function under test.
2021-12-06 14:00:38 +00:00
Ben Thorner
0318229216 Stop 'timing out' old 'created' notifications
This is being replaced with a new alert and runbook [1]. It's not
always appropriate to change the status to 'technical-failure', and
the new alert means we'll act to fix the underlying issue promptly.

We'll look at tidying up the remaining code in the next commits.

[1]: https://github.com/alphagov/notifications-manuals/wiki/Support-Runbook#deal-with-email-or-sms-still-in-created
2021-12-06 14:00:36 +00:00
Ben Thorner
d1586a8f81 CC DVLA in tickets about outstanding letters
Previously we sent them emails about this manually. We also tried
a Zendesk macro/trigger approach, but using a CC means:

- We can control the behaviour ourselves (Zendesk triggers can only
be edited by admins outside our team).

- We keep the DVLA notification approach consistent and in one place,
so notifications always go to the same people.

- Any further (public) updates to the ticket will also trigger a
notification to DVLA (previous trigger only notified on creation).
2021-10-29 11:46:29 +01:00
Leo Hemsted
b8c4e19072 tweak zendesk message for no ack files alert
include a link to a runbook entry.

also the list of acknowledgement files can be very long, so make that
the last thing, and use new lines to space out the message.
2021-10-08 13:45:02 +01:00
Katie Smith
2f66e38fb9 Update how "missing ackfile for letters" Zendesk tickets are created 2021-09-29 11:10:50 +01:00
Katie Smith
64c0a3fb9d Update how 'letters still sending' Zendesk tickets are created
These now use the new Zendesk form.
2021-09-29 11:07:37 +01:00
David McDonald
41d95378ea Remove everything for the performance platform
We no longer will send them any stats so therefore don't need the code
- the code to work out the nightly stats
- the performance platform client
- any configuration for the client
- any nightly tasks that kick off the sending off the stats

We will require a change in cronitor as we no longer will have this task
run meaning we need to delete the cronitor check.
2021-03-15 12:04:53 +00:00
David McDonald
8325431462 Move saving of processing time into separate task
We current do this as part of send-daily-performance-platform-stats but
now this moves it into its own separate task. This is for two reasons
- we will shortly get rid of the send-daily-performance-platform-stats
  task as we no longer will need to send anything to performance
  platform
- even if we did decide to keep the task
  send-daily-performance-platform-stats and remove the specific bits
  that relate to the performance platform, it's probably nicer to
  rewrite the new task from scratch to make sure it's all clear and easy
  to understand
2021-03-15 11:44:01 +00:00
Ben Thorner
a91fde2fda Run auto-correct on app/ and tests/ 2021-03-12 11:45:45 +00:00
David McDonald
c3ef23c771 Alert on 2nd class letters still in sending everyday
In 8285ef5f89
we turned off alerting on 2nd class letters still being in sending on
certain days of the week because we were only sending letters out on
Mon, Wed, Fri.

Now we have swapped back to sending out 2nd class letters on all
workdays so this change can be reverted. Note, I haven't reverted the
commit exactly but more so the behaviour, whilst leaving in some tests
to explicitly test 2nd class letters for the alert in case we change
this again.
2021-01-13 11:21:27 +00:00
Katie Smith
62b11bc61e Delete delete_dvla_response_files_older_than_seven_days task
This was not being used.
2020-04-02 14:49:47 +01:00
David McDonald
98d8388805 Add runbook link to ticket 2020-04-02 09:42:46 +01:00
David McDonald
b28fffc330 Refactor raise_alert_if_letter_notifications_still_sending
Move finding of letter logic into a separate method so it can be unit
tested rather than having to test it by checking the contents of a
zendesk ticket api call.

This will enable us to change the zendesk api ticket call message
without needing to edit lots of tests.
2020-04-02 09:36:56 +01:00
David McDonald
a14d5f0225 Remove task that no longer runs
We no longer puts files in these s3 buckets (and have in fact deleted
the buckets) therefore this task is redundant and can be removed.
2020-02-06 10:57:43 +00:00
Leo Hemsted
8285ef5f89 only check for dvla response files on mon/weds/fri
dvla don't process 2nd class files on tues and thurs
2019-10-08 18:16:45 +01:00
Leo Hemsted
6965478afc explicitly name days in celery unit tests
make it easier to understand what's happening
2019-10-07 08:58:09 +01:00
Katie Smith
09e8ac9644 Fix assertions when we catch an error in the tests
Code that is within a `with Python.raises(...)` context manager but
comes after the line that raises the exception doesn't get evaluated.
We had some assertions that we never being tested because of this, so
this ensures that they will always get run and fixes them where
necessary.
2019-09-18 11:04:24 +01:00
Rebecca Law
ae1bc54f9e Update NotificationTechnicalFailureException
- Change the NotificationTechnicalFailureException so that it only inherits from Exception.
- The notify_celery task should create the logging message on failure.
- Fix unit tests
- Remove named parameter when raising exception.
2019-08-12 16:51:39 +01:00
Leo Hemsted
67f171f2f8 refactor tests
re-order notification dao delete notifications test to move "fixtures"
to the top of the file

changed create_service_data_retention to take an ORM object, not an id.
brings it in line with other db.py test functions
2019-06-03 17:27:08 +01:00
Rebecca Law
4ce2b9eaba The rstrip was not working for all file names so this changes it to a replace. 2019-04-08 12:04:14 +01:00
Rebecca Law
dc8159104e Update letter_raise_alert_if_no_ack_file_for_zip for new DVLA file format
When we send a zip file of letters to DVLA we expect them to send back an acknowledgement of those files.
Previously they named the files like NOTIFY.20180202091254.ACK.TXT and the contents would contain the name of the zip file we sent with a date of when they got it.
They have updated this format to mirror the format of the zip file because there was an instance where they sent 2 files of the same name so the later overwrote the first.
Since the name matches our name, there is no need to get the file from S3 but just compare file names.
2019-04-03 11:03:42 +01:00
Leo Hemsted
3739d9055d clean up usage of dates/datetimes in performance platform tasks
* call variables unambiguous things like `start_time` or `bst_date` to
  reduce risk of passing in the wrong thing
* simplify the count_dict object - remove nested dict and start_date
  fields as superfluous
* use static datetime objects in tests rather than calculating them
  each time
2019-04-02 11:49:20 +01:00
Rebecca Law
1456aa7789 Fix for performance platform updates.
Changed the query to get the performance platform stats from ft_notification_status. But the date used for the query needed to be a date, not datetime so the equality worked.
2019-04-01 12:03:57 +01:00
Rebecca Law
1806f092f3 Update the nightly task that send performance platform statistics to use ft_notification_status rather than notification_history.
The previous query was including all notifications regardless of notification_status. I don't think that's right, it shouldn't include things like technical-failure or validation-failed. Thoughts?

I also need to remove the query that's no longer being used.
2019-03-29 14:21:05 +00:00
Leo Hemsted
38f0ea6cca remove functions to not talk about 7 days
remind us that data retention is flexible
2019-02-26 17:57:35 +00:00
Leo Hemsted
f5198bf71d remove unnecessary job_types arg from remove_csv_files celery tasks 2019-01-22 10:31:37 +00:00
Leo Hemsted
d783e2b236 move tests from test_scheduled_tasks to test_nightly_tasks 2019-01-18 15:36:53 +00:00