Skip to content

Commit

Permalink
(v1) Integration test - custom environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoraboeuf committed May 25, 2016
1 parent b515ba6 commit 7149817
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,39 +34,6 @@ class GenerationTest {
jenkins.defaultSeed()
}

@Test
void 'Custom environment variable'() {
// Project name
def projectName = uid('p')
// Configuration of environment variables
String seed = jenkins.seed(
new PipelineConfig()
.withBranchParameters('BRANCH_PARAM: Additional parameter')
)
// Firing the seed job
jenkins.fireJob(seed, [
PROJECT : projectName,
PROJECT_SCM_TYPE: 'git',
// Path to the prepared Git repository in docker.gradle
PROJECT_SCM_URL : '/var/lib/jenkins/tests/git/seed-env',
]).checkSuccess()
// Checks the project seed is created
jenkins.job("${projectName}/${projectName}-seed")
// Fires the project seed
jenkins.fireJob("${projectName}/${projectName}-seed", [
BRANCH : 'master',
BRANCH_PARAM: 'test',
]).checkSuccess()
// Checks the branch seed is created
jenkins.job("${projectName}/${projectName}-master/${projectName}-master-seed")
// Fires the branch seed
jenkins.fireJob("${projectName}/${projectName}-master/${projectName}-master-seed").checkSuccess()
// Checks the branch pipeline is there
jenkins.job("${projectName}/${projectName}-master/${projectName}-master-build")
// Fires the branch pipeline start
jenkins.fireJob("${projectName}/${projectName}-master/${projectName}-master-build", [COMMIT: 'HEAD']).checkSuccess()
}

@Test
void 'Branch SCM parameter'() {
// Project name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.nemerosa.jenkins.seed.integration

import net.nemerosa.jenkins.seed.config.PipelineConfig
import net.nemerosa.jenkins.seed.integration.git.GitRepo
import org.junit.Rule
import org.junit.Test
Expand Down Expand Up @@ -71,4 +72,38 @@ class GenerationIntegrationTest {
jenkins.getBuild("${projectName}/${projectName}-master/${projectName}-master-ci", 1).checkSuccess()
jenkins.getBuild("${projectName}/${projectName}-master/${projectName}-master-publish", 1).checkSuccess()
}

@Test
void 'Custom environment variable'() {
// Project name
def projectName = uid('p')
// Prepares Git repository
def git = GitRepo.prepare('env')
// Configuration of environment variables
String seed = jenkins.seed(
new PipelineConfig()
.withBranchParameters('BRANCH_PARAM: Additional parameter')
)
// Firing the seed job
jenkins.fireJob(seed, [
PROJECT : projectName,
PROJECT_SCM_TYPE: 'git',
PROJECT_SCM_URL : git
]).checkSuccess()
// Checks the project seed is created
jenkins.checkJobExists("${projectName}/${projectName}-seed")
// Fires the project seed
jenkins.fireJob("${projectName}/${projectName}-seed", [
BRANCH : 'master',
BRANCH_PARAM: 'test',
]).checkSuccess()
// Checks the branch seed is created
jenkins.checkJobExists("${projectName}/${projectName}-master/${projectName}-master-seed")
// Fires the branch seed
jenkins.fireJob("${projectName}/${projectName}-master/${projectName}-master-seed").checkSuccess()
// Checks the branch pipeline is there
jenkins.checkJobExists("${projectName}/${projectName}-master/${projectName}-master-build")
// Fires the branch pipeline start
jenkins.fireJob("${projectName}/${projectName}-master/${projectName}-master-build", [COMMIT: 'HEAD']).checkSuccess()
}
}

0 comments on commit 7149817

Please sign in to comment.