public class RestartableJenkinsRule extends Object implements org.junit.rules.MethodRule
To use this, add this rule instead of JenkinsRule to the test,
then from your test method, call step(Closure) or addStep(Statement) repeatedly.
The rule will evaluate your test method to collect all steps, then execute them in turn and restart Jenkins in between.
JenkinsRule| Modifier and Type | Class and Description |
|---|---|
static class |
RestartableJenkinsRule.Builder |
static interface |
RestartableJenkinsRule.Step
One step to run, intended to be a SAM for lambdas with
then(org.jvnet.hudson.test.RestartableJenkinsRule.Step). |
| Modifier and Type | Field and Description |
|---|---|
File |
home
JENKINS_HOME
|
JenkinsRule |
j |
| Constructor and Description |
|---|
RestartableJenkinsRule() |
| Modifier and Type | Method and Description |
|---|---|
void |
addStep(org.junit.runners.model.Statement step) |
void |
addStep(org.junit.runners.model.Statement step,
boolean expectedToStartCorrectly) |
void |
addStepWithDirtyShutdown(org.junit.runners.model.Statement step)
Similar to
addStep(Statement) but we simulate a dirty shutdown after the step, rather than a clean one. |
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runners.model.FrameworkMethod method,
Object target) |
protected JenkinsRule |
createJenkinsRule(org.junit.runner.Description description) |
void |
step(groovy.lang.Closure c) |
void |
then(RestartableJenkinsRule.Step s)
Run one Jenkins session and shut down.
|
void |
thenDoesNotStart() |
void |
thenWithHardShutdown(RestartableJenkinsRule.Step s)
Run one Jenkins session and then simulate the Jenkins process ending without a clean shutdown.
|
public JenkinsRule j
public File home
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runners.model.FrameworkMethod method,
Object target)
apply in interface org.junit.rules.MethodRulepublic void step(groovy.lang.Closure c)
public void then(RestartableJenkinsRule.Step s)
public void thenWithHardShutdown(RestartableJenkinsRule.Step s)
Implementation note: we're actually just copying the JENKINS_HOME, which takes some time - so the shutdown isn't truly instant (additional data may be written while this happens).
public void thenDoesNotStart()
public void addStep(org.junit.runners.model.Statement step)
public void addStep(org.junit.runners.model.Statement step,
boolean expectedToStartCorrectly)
public void addStepWithDirtyShutdown(org.junit.runners.model.Statement step)
addStep(Statement) but we simulate a dirty shutdown after the step, rather than a clean one.
See thenWithHardShutdown(Step) for how this is done.protected JenkinsRule createJenkinsRule(org.junit.runner.Description description)
Copyright © 2004–2019. All rights reserved.