1
0

Исправлено получение переменных среды

This commit is contained in:
Nikita Gryzlov
2020-04-16 12:39:25 +03:00
parent b3ace45d3a
commit b2af725362
6 changed files with 60 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition
import org.jenkinsci.plugins.workflow.job.WorkflowJob
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.jvnet.hudson.test.JenkinsRule
class printLocationTest {
@Rule
public JenkinsRule rule = new JenkinsRule()
@Before
void configureGlobalGitLibraries() {
RuleBootstrapper.setup(rule)
}
@Test
void "Logger should echo current node name"() {
def pipeline = '''
import ru.pulsar.jenkins.library.utils.Logger
pipeline {
agent any
stages {
stage('test') {
steps {
printLocation()
}
}
}
}
'''.stripIndent()
final CpsFlowDefinition flow = new CpsFlowDefinition(pipeline, true)
final WorkflowJob workflowJob = rule.createProject(WorkflowJob, 'project')
workflowJob.definition = flow
rule.assertLogContains('Running on node master', rule.buildAndAssertSuccess(workflowJob))
}
}