-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into apptainer-oci-mode
- Loading branch information
Showing
12 changed files
with
83 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
|
||
package nextflow.script | ||
|
||
import java.nio.file.Files | ||
import java.nio.file.Paths | ||
import java.time.Instant | ||
import java.time.OffsetDateTime | ||
|
@@ -256,7 +257,7 @@ class WorkflowNotifierTest extends Specification { | |
when: | ||
workflow.success = false | ||
workflow.runName = 'bar' | ||
mail = notifier.createMail([to:'[email protected]', from:'[email protected]', template: ['/some/file.txt', '/other/file.html'], binding: [one:1, two:2]]) | ||
mail = notifier.createMail([to:'[email protected]', from:'[email protected]', template: ['/some/file.txt', '/other/file.html'], attributes: [one:1, two:2]]) | ||
then: | ||
1 * notifier.loadMailTemplate(new File('/some/file.txt'), [one:1, two:2]) >> 'TEXT template' | ||
1 * notifier.loadMailTemplate(new File('/other/file.html'), [one:1, two:2]) >> 'HTML template' | ||
|
@@ -268,6 +269,40 @@ class WorkflowNotifierTest extends Specification { | |
|
||
} | ||
|
||
def 'should create notification mail with custom template' () { | ||
given: | ||
def folder = Files.createTempDirectory('test') | ||
def template = folder.resolve('template.txt').toFile(); template.text = 'Hello world!' | ||
|
||
and: | ||
Mail mail | ||
def workflow = new WorkflowMetadata() | ||
def notifier = Spy(WorkflowNotifier) | ||
notifier.@workflow = workflow | ||
|
||
/* | ||
* create success completion *default* notification email | ||
*/ | ||
when: | ||
workflow.success = true | ||
workflow.runName = 'foo' | ||
mail = notifier.createMail([to:'[email protected]', from:'[email protected]', template: template]) | ||
then: | ||
0 * notifier.loadDefaultTextTemplate() | ||
0 * notifier.loadDefaultHtmlTemplate() | ||
1 * notifier.loadMailTemplate(template, [:]) | ||
and: | ||
mail.to == '[email protected]' | ||
mail.from == '[email protected]' | ||
mail.subject == 'Workflow completion [foo] - SUCCEED' | ||
mail.text == 'Hello world!' | ||
!mail.body | ||
!mail.attachments | ||
|
||
cleanup: | ||
folder?.deleteDir() | ||
} | ||
|
||
|
||
def 'should send notification email' () { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters