Skip to content
Permalink
Browse files

better behavior for bpipe test with send, and send for missing outputs

  • Loading branch information...
ssadedin committed Aug 12, 2019
1 parent 2b59167 commit 3e586e20dac0b1018bd8e5eb9f66e9e563367963
Showing with 20 additions and 6 deletions.
  1. +20 −6 src/main/groovy/bpipe/Sender.groovy
@@ -216,11 +216,17 @@ class Sender {

final File sentFile = determineSentFile(cfgName)
if(sentFile.exists() && !Dependencies.instance.getOutOfDate([new LocalPipelineFile(sentFile.absolutePath)], ctx.@input)) {
log.info "Sent file $sentFile.absolutePath already exists - skipping send of this message"
if(onSend != null) {
onSend(details)
}
return

if(extraDetails.file && !Utils.fileExists(extraDetails.file)) {
log.info "Sent file $sentFile.absolutePath already exists but destination is missing file: will send again"
}
else {
log.info "Sent file $sentFile.absolutePath already exists - skipping send of this message"
if(onSend != null) {
onSend(details)
}
return
}
}

if(Runner.testMode) {
@@ -316,8 +322,16 @@ class Sender {
StringWriter sw = new StringWriter()

Utils.table(['Property','Value'], [extraDetails*.key, extraDetails*.value].transpose(), out: sw)

String msg = "Would send message to channel '$cfgName' using details:\n\n" + sw.toString()
if(content instanceof String) {
if(this.contentType == "application/json") {
content = JsonOutput.prettyPrint(content)
}
msg = msg + "\n\nContent:\n"+ content.readLines().take(30).join('\n')
}

throw new PipelineTestAbort("Would send message to channel '$cfgName' using details:\n\n" + sw.toString())
throw new PipelineTestAbort(msg)
}

void sendToURL(Map details) {

0 comments on commit 3e586e2

Please sign in to comment.
You can’t perform that action at this time.