improve test case
This commit is contained in:
parent
2ea8ebdbc8
commit
a825eb02cf
|
@ -242,6 +242,7 @@ public class TestMetaCache {
|
||||||
Exception exp;
|
Exception exp;
|
||||||
boolean success;
|
boolean success;
|
||||||
long initialMetaCacheHits = metrics.getMetaCacheHits();
|
long initialMetaCacheHits = metrics.getMetaCacheHits();
|
||||||
|
long initialMetaCacheMisses = metrics.getMetaCacheMisses();
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++) {
|
||||||
exp = null;
|
exp = null;
|
||||||
success = false;
|
success = false;
|
||||||
|
@ -257,8 +258,9 @@ public class TestMetaCache {
|
||||||
// The value of the metaCacheHits counter is incremented by 6 in each round of the loop,
|
// The value of the metaCacheHits counter is incremented by 6 in each round of the loop,
|
||||||
// for 0th iteration there will be 5 hits + 1 cache miss.
|
// for 0th iteration there will be 5 hits + 1 cache miss.
|
||||||
assertEquals(initialMetaCacheHits + 6 * i + 5, metrics.getMetaCacheHits());
|
assertEquals(initialMetaCacheHits + 6 * i + 5, metrics.getMetaCacheHits());
|
||||||
// We will get a cache miss only on the first request, so the value will always be 1.
|
// We will get a cache miss only on the first request, so the value will always be
|
||||||
assertEquals(1, metrics.getMetaCacheMisses());
|
// initialMetaCacheMisses + 1
|
||||||
|
assertEquals(initialMetaCacheMisses + 1, metrics.getMetaCacheMisses());
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
// Only keep track of the last exception that updated the meta cache
|
// Only keep track of the last exception that updated the meta cache
|
||||||
if (ClientExceptionsUtil.isMetaClearingException(ex) || success) {
|
if (ClientExceptionsUtil.isMetaClearingException(ex) || success) {
|
||||||
|
|
Loading…
Reference in New Issue