|
62 | 62 | import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsConstants.SNAPSHOT_BLOB_CACHE_INDEX; |
63 | 63 | import static org.hamcrest.Matchers.equalTo; |
64 | 64 | import static org.hamcrest.Matchers.greaterThan; |
| 65 | +import static org.hamcrest.Matchers.greaterThanOrEqualTo; |
65 | 66 |
|
66 | 67 | public class SearchableSnapshotsBlobStoreCacheIntegTests extends BaseSearchableSnapshotsIntegTestCase { |
67 | 68 |
|
@@ -154,8 +155,7 @@ public void testBlobStoreCache() throws Exception { |
154 | 155 | () -> systemClient().admin().indices().prepareGetIndex().addIndices(SNAPSHOT_BLOB_CACHE_INDEX).get() |
155 | 156 | ); |
156 | 157 |
|
157 | | - // TODO randomize this with FULL_COPY too when cold tier also handle blob cache for footers |
158 | | - final Storage storage = Storage.SHARED_CACHE; |
| 158 | + final Storage storage = randomFrom(Storage.values()); |
159 | 159 | logger.info( |
160 | 160 | "--> mount snapshot [{}] as an index for the first time [storage={}, max length={}]", |
161 | 161 | snapshot, |
@@ -264,7 +264,13 @@ public void testBlobStoreCache() throws Exception { |
264 | 264 | new SearchableSnapshotsStatsRequest() |
265 | 265 | ).actionGet().getStats()) { |
266 | 266 | for (final SearchableSnapshotShardStats.CacheIndexInputStats indexInputStats : shardStats.getStats()) { |
267 | | - assertThat(Strings.toString(indexInputStats), indexInputStats.getBlobStoreBytesRequested().getCount(), equalTo(0L)); |
| 267 | + assertThat( |
| 268 | + Strings.toString(indexInputStats), |
| 269 | + indexInputStats.getBlobStoreBytesRequested().getCount(), |
| 270 | + storage == Storage.SHARED_CACHE ? equalTo(0L) |
| 271 | + : indexInputStats.getFileExt().equals("cfs") ? greaterThanOrEqualTo(0L) |
| 272 | + : equalTo(0L) |
| 273 | + ); |
268 | 274 | } |
269 | 275 | } |
270 | 276 |
|
@@ -308,7 +314,13 @@ public Settings onNodeStopped(String nodeName) throws Exception { |
308 | 314 | new SearchableSnapshotsStatsRequest() |
309 | 315 | ).actionGet().getStats()) { |
310 | 316 | for (final SearchableSnapshotShardStats.CacheIndexInputStats indexInputStats : shardStats.getStats()) { |
311 | | - assertThat(Strings.toString(indexInputStats), indexInputStats.getBlobStoreBytesRequested().getCount(), equalTo(0L)); |
| 317 | + assertThat( |
| 318 | + Strings.toString(indexInputStats), |
| 319 | + indexInputStats.getBlobStoreBytesRequested().getCount(), |
| 320 | + storage == Storage.SHARED_CACHE ? equalTo(0L) |
| 321 | + : indexInputStats.getFileExt().equals("cfs") ? greaterThanOrEqualTo(0L) |
| 322 | + : equalTo(0L) |
| 323 | + ); |
312 | 324 | } |
313 | 325 | } |
314 | 326 |
|
|
0 commit comments