@@ -41,6 +41,7 @@ import nextflow.script.BodyDef
4141import nextflow.script.ProcessConfig
4242import nextflow.script.ScriptType
4343import nextflow.script.bundle.ResourcesBundle
44+ import nextflow.script.params.CmdEvalParam
4445import nextflow.script.params.FileInParam
4546import nextflow.script.params.FileOutParam
4647import nextflow.util.ArrayBag
@@ -1218,4 +1219,52 @@ class TaskProcessorTest extends Specification {
12181219 0 * collector. collect(task)
12191220 1 * exec. submit(task)
12201221 }
1222+
1223+ def ' should use eval outputs in hash' () {
1224+ given :
1225+ def session = Mock (Session ) {
1226+ getDumpHashes() >> ' json'
1227+ getUniqueId() >> UUID . fromString(' b69b6eeb-b332-4d2c-9957-c291b15f498c' )
1228+ getBinEntries() >> [' foo.sh' : Paths . get(' /some/path/foo.sh' ), ' bar.sh' : Paths . get(' /some/path/bar.sh' )]
1229+ }
1230+ def outParam = Mock (CmdEvalParam ) {
1231+ getTarget( _ as Map ) >> ' foo --version'
1232+ }
1233+ def task1 = Spy (TaskRun ) {
1234+ getSource() >> ' hello world'
1235+ lazyName() >> ' hello'
1236+ isContainerEnabled() >> false
1237+ getContainer() >> null
1238+ getSpackEnv() >> null
1239+ getCondaEnv() >> null
1240+ getConfig() >> Mock (TaskConfig )
1241+ getContext() >> [:]
1242+ }
1243+ def task2 = Spy (TaskRun ) {
1244+ getSource() >> ' hello world'
1245+ lazyName() >> ' hello'
1246+ isContainerEnabled() >> false
1247+ getContainer() >> null
1248+ getSpackEnv() >> null
1249+ getCondaEnv() >> null
1250+ getConfig() >> Mock (TaskConfig )
1251+ getContext() >> [:]
1252+ }
1253+ task2. setOutput(outParam)
1254+
1255+ def processor = Spy (TaskProcessor ){
1256+ getTaskGlobalVars( _ as TaskRun ) >> [foo :' a' , bar :' b' ]
1257+ }
1258+ processor. @session = session
1259+ processor. @config = Mock (ProcessConfig )
1260+
1261+ when :
1262+ def uuid1 = processor. createTaskHashKey(task1)
1263+ def uuid2 = processor. createTaskHashKey(task2)
1264+
1265+ then :
1266+ uuid1 != uuid2
1267+
1268+ }
1269+
12211270}
0 commit comments