Skip to content

Commit

Permalink
Added a default dnap-ssr email recipient
Browse files Browse the repository at this point in the history
... to a list of recipients of emails for subscribers.
This type of email is sent for every eligible event.
  • Loading branch information
mgcam committed May 17, 2024
1 parent 03fa124 commit 074b985
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/npg_tracking/report/event2subscribers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Readonly::Scalar my $TEMPLATE_EXT => q[.tt2];
## no critic (ValuesAndExpressions::RequireInterpolationOfMetachars)
Readonly::Scalar my $DEFAULT_RECIPIENT_HOST => q[@sanger.ac.uk];
## use critic
Readonly::Array my @DEFAULT_RECIPIENTS => qw[dnap-ssr];
Readonly::Scalar my $DEFAULT_AUTHOR => q[srpipe];
Readonly::Scalar my $MLWH_DRIVER_TYPE => q[ml_warehouse_fc_cache];

Expand Down Expand Up @@ -159,7 +160,7 @@ sub username2email_address {
sub _subscribers {
my $self = shift;
my $group = $self->_is_instrument_event ? q[engineers] : q[events];
my @subscribers = ();
my @subscribers = @DEFAULT_RECIPIENTS;
my $schema = $self->event_entity->result_source->schema;
my $group_row = $schema->resultset('Usergroup')->search(
{groupname => $group, iscurrent => 1})->next();
Expand Down
15 changes: 10 additions & 5 deletions t/80-npg_tracking-report-event2subscribers.t
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ subtest 'run status event' => sub {
ok ($e->dry_run, 'dry_run mode');
is ($e->report_author(), $report_author, 'report author');
is ($e->template_name(), 'run_or_lane2subscribers', 'template name');
is_deeply ($e->_subscribers(), [qw([email protected] [email protected] [email protected])],
is_deeply ($e->_subscribers(),
[qw([email protected] [email protected] [email protected] [email protected])],
'correct ordered list of subscribers');
is ($e->report_short(), 'Run 21915 was assigned status "run pending"', 'short report text');

Expand Down Expand Up @@ -205,7 +206,8 @@ subtest 'instrument status event' => sub {
isa_ok ($e, 'npg_tracking::report::event2subscribers');
is ($e->report_author(), $report_author, 'report author');
is ($e->template_name(), 'instrument', 'template name');
is_deeply ($e->_subscribers(), [qw([email protected] [email protected] [email protected])],
is_deeply ($e->_subscribers(),
[qw([email protected] [email protected] [email protected] [email protected])],
'correct ordered list of subscribers');
is ($e->report_short(), 'Instrument HS8 status changed to "wash performed"', 'short report text');
warning_is {$e->lims} undef, 'no warning about LIMs driver';
Expand Down Expand Up @@ -260,7 +262,8 @@ subtest 'run annotation event' => sub {
ok ($e->dry_run, 'dry_run mode');
is ($e->report_author(), $report_author, 'report author');
is ($e->template_name(), 'run_or_lane2subscribers', 'template name');
is_deeply ($e->_subscribers(), [qw([email protected] [email protected] [email protected])],
is_deeply ($e->_subscribers(),
[qw([email protected] [email protected] [email protected] [email protected])],
'correct ordered list of subscribers');
is ($e->report_short(), 'Run 21915 annotated by joe_loader', 'short report text');
is (scalar @{$e->lims}, 8, 'Retrieved LIMs object');
Expand Down Expand Up @@ -305,7 +308,8 @@ subtest 'runlane annotation event' => sub {
ok ($e->dry_run, 'dry_run mode');
is ($e->report_author(), $report_author, 'report author');
is ($e->template_name(), 'run_or_lane2subscribers', 'template name');
is_deeply ($e->_subscribers(), [qw([email protected] [email protected] [email protected])],
is_deeply ($e->_subscribers(),
[qw([email protected] [email protected] [email protected] [email protected])],
'correct ordered list of subscribers');
is ($e->report_short(), 'Run 21915 lane 2 annotated by joe_loader', 'short report text');
is (scalar @{$e->lims}, 1, 'Retrieved LIMs object');
Expand Down Expand Up @@ -350,7 +354,8 @@ subtest 'instrument annotation event' => sub {
isa_ok ($e, 'npg_tracking::report::event2subscribers');
is ($e->report_author(), $report_author, 'report author');
is ($e->template_name(), 'instrument', 'template name');
is_deeply ($e->_subscribers(), [qw([email protected] [email protected] [email protected])],
is_deeply ($e->_subscribers(),
[qw([email protected] [email protected] [email protected] [email protected])],
'correct ordered list of subscribers');
is ($e->report_short(), 'Instrument HS8 annotated by joe_loader', 'short report text');
warning_is {$e->lims} undef, 'no warning about LIMs driver';
Expand Down

0 comments on commit 074b985

Please sign in to comment.