Class TestInjection

java.lang.Object
org.apache.solr.util.TestInjection

public class TestInjection extends Object
Allows random faults to be injected in running code during test runs.

Set static strings to "true" or "false" or "true:60" for true 60% of the time.

All methods are No-Ops unless LuceneTestCase is loadable via the ClassLoader used to load this class. LuceneTestCase.random() is used as the source of all entropy.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
  • Field Details

    • nonGracefullClose

      public static volatile String nonGracefullClose
    • failReplicaRequests

      public static volatile String failReplicaRequests
    • failUpdateRequests

      public static volatile String failUpdateRequests
    • leaderTragedy

      public static volatile String leaderTragedy
    • nonExistentCoreExceptionAfterUnload

      public static volatile String nonExistentCoreExceptionAfterUnload
    • updateLogReplayRandomPause

      public static volatile String updateLogReplayRandomPause
    • updateRandomPause

      public static volatile String updateRandomPause
    • prepRecoveryOpPauseForever

      public static volatile String prepRecoveryOpPauseForever
    • randomDelayInCoreCreation

      public static volatile String randomDelayInCoreCreation
    • randomDelayMaxInCoreCreationInSec

      public static volatile int randomDelayMaxInCoreCreationInSec
    • splitFailureBeforeReplicaCreation

      public static volatile String splitFailureBeforeReplicaCreation
    • splitFailureAfterReplicaCreation

      public static volatile String splitFailureAfterReplicaCreation
    • splitLatch

      public static volatile CountDownLatch splitLatch
    • directUpdateLatch

      public static volatile CountDownLatch directUpdateLatch
    • reindexLatch

      public static volatile CountDownLatch reindexLatch
    • reindexFailure

      public static volatile String reindexFailure
    • failIndexFingerprintRequests

      public static volatile String failIndexFingerprintRequests
    • wrongIndexFingerprint

      public static volatile String wrongIndexFingerprint
    • delayBeforeFollowerCommitRefresh

      public static volatile Integer delayBeforeFollowerCommitRefresh
    • delayInExecutePlanAction

      public static volatile Integer delayInExecutePlanAction
    • delayBeforeCreatingNewDocSet

      public static volatile Integer delayBeforeCreatingNewDocSet
    • countDocSetDelays

      public static volatile AtomicInteger countDocSetDelays
    • queryTimeout

      public static volatile QueryLimit queryTimeout
    • failInExecutePlanAction

      public static volatile boolean failInExecutePlanAction
    • cpuTimerDelayInjectedNS

      public static volatile AtomicInteger cpuTimerDelayInjectedNS
    • skipIndexWriterCommitOnClose

      public static volatile boolean skipIndexWriterCommitOnClose
      Defaults to false, If set to true, then injectSkipIndexWriterCommitOnClose(java.lang.Object) will return true
      See Also:
    • uifOutOfMemoryError

      public static volatile boolean uifOutOfMemoryError
  • Constructor Details

    • TestInjection

      public TestInjection()
  • Method Details

    • notifyPauseForeverDone

      public static void notifyPauseForeverDone()
    • reset

      public static void reset()
    • injectWrongIndexFingerprint

      public static boolean injectWrongIndexFingerprint()
    • injectFailIndexFingerprintRequests

      public static boolean injectFailIndexFingerprintRequests()
    • injectRandomDelayInCoreCreation

      public static boolean injectRandomDelayInCoreCreation()
    • injectNonGracefullClose

      public static boolean injectNonGracefullClose(CoreContainer cc)
    • injectSkipIndexWriterCommitOnClose

      public static boolean injectSkipIndexWriterCommitOnClose(Object indexWriter)
      Returns the value of skipIndexWriterCommitOnClose.
      Parameters:
      indexWriter - used only for logging
      See Also:
    • injectFailReplicaRequests

      public static boolean injectFailReplicaRequests()
    • injectFailUpdateRequests

      public static boolean injectFailUpdateRequests()
    • injectLeaderTragedy

      public static boolean injectLeaderTragedy(SolrCore core)
    • injectNonExistentCoreExceptionAfterUnload

      public static boolean injectNonExistentCoreExceptionAfterUnload(String cname)
    • injectUpdateLogReplayRandomPause

      public static boolean injectUpdateLogReplayRandomPause()
    • injectUpdateRandomPause

      public static boolean injectUpdateRandomPause()
    • injectPrepRecoveryOpPauseForever

      public static boolean injectPrepRecoveryOpPauseForever()
    • injectSplitFailureBeforeReplicaCreation

      public static boolean injectSplitFailureBeforeReplicaCreation()
    • injectSplitFailureAfterReplicaCreation

      public static boolean injectSplitFailureAfterReplicaCreation()
    • injectSplitLatch

      public static boolean injectSplitLatch()
    • injectDirectUpdateLatch

      public static boolean injectDirectUpdateLatch()
    • measureCpu

      public static void measureCpu()
    • injectCpuUseInSearcherCpuLimitCheck

      public static void injectCpuUseInSearcherCpuLimitCheck()
    • injectReindexFailure

      public static boolean injectReindexFailure()
    • injectReindexLatch

      public static boolean injectReindexLatch()
    • injectDelayBeforeFollowerCommitRefresh

      public static boolean injectDelayBeforeFollowerCommitRefresh()
    • injectUIFOutOfMemoryError

      public static boolean injectUIFOutOfMemoryError()
    • injectDocSetDelay

      public static boolean injectDocSetDelay(Object query)
    • newSearcherHook

      public static boolean newSearcherHook(TestInjection.Hook hook)
    • injectSearcherHooks

      public static boolean injectSearcherHooks(String collectionName)