Package org.apache.lucene.tests.util
Class TestRuleLimitSysouts
- java.lang.Object
-
- com.carrotsearch.randomizedtesting.rules.TestRuleAdapter
-
- org.apache.lucene.tests.util.TestRuleLimitSysouts
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class TestRuleLimitSysouts extends com.carrotsearch.randomizedtesting.rules.TestRuleAdapterThis test rule serves two purposes:- it fails the test if it prints too much to stdout and stderr (tests that chatter too much are discouraged)
- the rule ensures an absolute hard limit of stuff written to stdout and stderr to prevent accidental infinite loops from filling all available disk space with persisted output.
isEnforced()).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceTestRuleLimitSysouts.LimitAn annotation specifying the limit of bytes per class.
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_HARD_LIMITMax hard limit of sysout bytes.static longDEFAULT_LIMITMax limit of bytes printed to eitherSystem.outorSystem.err.static intMAX_LIMITMaximum limit allowed forTestRuleLimitSysouts.Limit.bytes()before sysout check suppression is suggested.
-
Constructor Summary
Constructors Constructor Description TestRuleLimitSysouts(TestRuleMarkFailure failureMarker)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterAlways(List<Throwable> errors)protected voidafterIfSuccessful()We're only interested in failing the suite if it was successful (otherwise just propagate the original problem and don't bother doing anything else).protected voidbefore()static voidcheckCaptureStreams()EnsuresSystem.outandSystem.errpoint to delegate streams.protected booleanisEnforced()
-
-
-
Field Detail
-
DEFAULT_LIMIT
public static final long DEFAULT_LIMIT
Max limit of bytes printed to eitherSystem.outorSystem.err. This limit is enforced per-class (suite).- See Also:
- Constant Field Values
-
DEFAULT_HARD_LIMIT
public static final long DEFAULT_HARD_LIMIT
Max hard limit of sysout bytes.- See Also:
- Constant Field Values
-
MAX_LIMIT
public static final int MAX_LIMIT
Maximum limit allowed forTestRuleLimitSysouts.Limit.bytes()before sysout check suppression is suggested.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TestRuleLimitSysouts
public TestRuleLimitSysouts(TestRuleMarkFailure failureMarker)
-
-
Method Detail
-
before
protected void before() throws Throwable- Overrides:
beforein classcom.carrotsearch.randomizedtesting.rules.TestRuleAdapter- Throws:
Throwable
-
checkCaptureStreams
public static void checkCaptureStreams()
EnsuresSystem.outandSystem.errpoint to delegate streams.
-
isEnforced
protected boolean isEnforced()
-
afterIfSuccessful
protected void afterIfSuccessful() throws ThrowableWe're only interested in failing the suite if it was successful (otherwise just propagate the original problem and don't bother doing anything else).- Overrides:
afterIfSuccessfulin classcom.carrotsearch.randomizedtesting.rules.TestRuleAdapter- Throws:
Throwable
-
-