mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 13:32:24 +00:00
Add an annotation to enable skipping Jenkins provisioning for specific tests
This commit is contained in:
1 parent
8071d0768f
commit
1d5cdddf1f
2 files changed
+23
No files matched your search
@@ -412,6 +412,10 @@ public class JenkinsRule implements TestRule, RootAction {
|
||||
}
|
||||
|
||||
public Statement apply(final Statement base, final Description description) {
|
||||
if (description.getAnnotation(WithoutJenkins.class) != null) {
|
||||
// request has been made to not create the instance for this test method
|
||||
return tempFolder.apply(base, description);
|
||||
}
|
||||
return tempFolder.apply(new Statement() {
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.jvnet.hudson.test;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
* An annotation for test methods that do not require the {@link JenkinsRule} to create and tear down the jenkins
|
||||
* instance.
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@Documented
|
||||
@Target(METHOD)
|
||||
public @interface WithoutJenkins {
|
||||
}
|
||||
Reference in new issue
Block a user