-
Notifications
You must be signed in to change notification settings - Fork 0
/
SetEnvTests.groovy
74 lines (58 loc) · 1.78 KB
/
SetEnvTests.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import java.nio.file.Path
import java.nio.file.Paths
import nextflow.util.ConfigHelper
import org.junit.Test
import validator.bl.NextflowConfigTests
class SetEnvTests extends NextflowConfigTests {
protected Path get_projectDir() {
return Paths.get(
getClass().protectionDomain.codeSource.location.path
).getParent().getParent()
}
@Override
protected def generate_config_text(configobj) {
return """
includeConfig "\${projectDir}/config/methods/common_methods.config"
${ConfigHelper.toCanonicalString(configobj)}
methods.set_env()
"""
}
@Test
void default_set_env() {
// With no further parameters, set_env() should set the result to $launchDir/work
expected.params.work_dir = builder.get_launchDir().resolve("work")
compare()
}
@Test
void envvar_set_env() {
def value = testFolder.getRoot().toString()
envvars.set("NXF_WORK", value)
expected.params.work_dir = value
compare()
}
@Test
void params_set_env() {
def value = testFolder.getRoot().toString()
inconfig.params.work_dir = value
expected.params.work_dir = value
compare()
}
@Test
void standardized_set_env() {
def value = testFolder.getRoot().toString()
inconfig.params.ucla_cds = true
inconfig.params.work_dir = value
expected.params.ucla_cds = true
expected.params.work_dir = value
compare()
}
@Test
void standard_default_set_env() {
def job_id = "1234321"
envvars.set("SLURM_JOB_ID", job_id)
inconfig.params.ucla_cds = true
expected.params.ucla_cds = true
expected.params.work_dir = "/scratch/${job_id}"
compare()
}
}