Class TestRegionNormalizerWorker
java.lang.Object
org.apache.hadoop.hbase.master.normalizer.TestRegionNormalizerWorker
A test over
RegionNormalizerWorker
. Being a background thread, the only points of
interaction we have to this class are its input source (RegionNormalizerWorkQueue
and its
callbacks invoked against RegionNormalizer
and MasterServices
. The work queue is
simple enough to use directly; for MasterServices
, use a mock because, as of now, the
worker only invokes 4 methods.-
Field Summary
Modifier and TypeFieldDescriptionstatic final HBaseClassTestRule
private org.apache.hadoop.hbase.master.MasterServices
org.mockito.junit.MockitoRule
private org.apache.hadoop.hbase.master.normalizer.RegionNormalizerWorkQueue<org.apache.hadoop.hbase.TableName>
private org.apache.hadoop.hbase.master.normalizer.RegionNormalizer
private HBaseCommonTestingUtil
org.junit.rules.TestName
private ExecutorService
private final AtomicReference<Throwable>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
after()
private <T> void
assertThatEventually
(String reason, Supplier<? extends T> actualSupplier, org.hamcrest.Matcher<? super T> matcher) Repeatedly evaluatesmatcher
against the result of callingactualSupplier
until the matcher succeeds or the timeout period of 30 seconds is exhausted.void
before()
void
void
void
Assert that a rate limit is honored, at least in a rough way.void
-
Field Details
-
CLASS_RULE
-
testName
-
tableName
-
mockitoRule
-
masterServices
@Mock(answer=RETURNS_DEEP_STUBS) private org.apache.hadoop.hbase.master.MasterServices masterServices -
regionNormalizer
-
testingUtility
-
queue
private org.apache.hadoop.hbase.master.normalizer.RegionNormalizerWorkQueue<org.apache.hadoop.hbase.TableName> queue -
workerPool
-
workerThreadThrowable
-
-
Constructor Details
-
TestRegionNormalizerWorker
public TestRegionNormalizerWorker()
-
-
Method Details
-
before
- Throws:
Exception
-
after
- Throws:
Exception
-
testMergeCounter
- Throws:
Exception
-
testSplitCounter
- Throws:
Exception
-
testRateLimit
Assert that a rate limit is honored, at least in a rough way. Maintainers should manually inspect the log messages emitted by the worker thread to confirm that expected behavior.- Throws:
Exception
-
testPlansSizeLimit
- Throws:
Exception
-
assertThatEventually
private <T> void assertThatEventually(String reason, Supplier<? extends T> actualSupplier, org.hamcrest.Matcher<? super T> matcher) throws Exception Repeatedly evaluatesmatcher
against the result of callingactualSupplier
until the matcher succeeds or the timeout period of 30 seconds is exhausted.- Throws:
Exception
-