Skip to content

Commit 4209c10

Browse files
Fix StoreDirectoryMetricsIT in release builds (#142690)
1 parent 9a416f7 commit 4209c10

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

server/src/internalClusterTest/java/org/elasticsearch/index/store/StoreDirectoryMetricsIT.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public void testDirectoryMetrics() throws IOException {
6262
});
6363
DirectoryMetrics metrics = tuple.v2();
6464
StoreMetrics storeMetrics = metrics.metrics("store").cast(StoreMetrics.class);
65-
assertThat(storeMetrics.getBytesRead(), equalTo(tuple.v1()));
65+
// In release builds the directory_metrics feature flag is disabled by default, so the store directory is not
66+
// wrapped with StoreMetricsDirectory and bytes read are not tracked.
67+
if (Store.DIRECTORY_METRICS_FEATURE_FLAG.isEnabled()) {
68+
assertThat(storeMetrics.getBytesRead(), equalTo(tuple.v1()));
69+
} else {
70+
assertThat(storeMetrics.getBytesRead(), equalTo(0L));
71+
}
6672
}
6773
}

0 commit comments

Comments
 (0)