Just wanted to re-highlight that some cleanup betw...
# nf-test
j
Just wanted to re-highlight that some cleanup between tests would be really helpful: https://github.com/askimed/nf-test/issues/315#issuecomment-4198293554
j
I don't know how much this would break things, but you could just delete the launchDir in the
cleanup
block for now. Perhaps you could gate it behind an env var that's set on the GH runner so it doesn't run during local testing.
Copy code
test("-profile test") {

        setup {
            ...
        }

        when {
            ...
        }

        then {
            ...
        }

        cleanup {
            new File("${launchDir}").deleteDir()
        }

    }
}
j
Interesting, thanks!
Don't think it would help with docker images though
I wonder if:
Copy code
cleanup {                                                                                                                                                                                                                                                                  
      "docker system prune -f".execute()                                                                                                                                                                                                                                     
      new File("${launchDir}").deleteDir()                                                                                                                                                                                                                                   
  }
... would work
j
You can run arbitrary subprocesses from Groovy too... an example I use:
Copy code
def checkm2_db_url  = "<https://tolit.cog.sanger.ac.uk/test-data/resources/metagenomeassembly/checkm2_database.tar.gz>"
            def checkm2_command = ['bash', '-c', "curl -L --retry 5 ${checkm2_db_url} | tar xzf - -C ${launchDir}"]
            def checkm2_proc = checkm2_command.execute()
            checkm2_proc.waitFor()
If there's a Docker command you could run to prune images you could execute that in the cleanup?
j
Lemme muck about - thanks!
👍 1
n
I agree and it's one of the features high on my priority list when I'm back to developing nf-test 🙂
thankyou 2
j
FWIW Jim's solution does work though 🙂
n
Good to know! I'll probably take some inspiration from it
j
Would be nice to be able to access nf-test success outputs in the
cleanup
block - e.g. to only execute if the task succeeded
n
Have you already made an issue for that?
j
Just realised I bumped shards at the same time, have bumped back, will let you know if things still pass due to cleanup
j
Have you already made an issue for that?
No 🥲
n
Thanks!!!!
j
Just realised I bumped shards at the same time, have bumped back, will let you know if things still pass due to cleanup
Still good
🎉 1