|
15 | 15 | import org.opensearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest;
|
16 | 16 | import org.opensearch.action.admin.indices.settings.put.UpdateSettingsRequestBuilder;
|
17 | 17 | import org.opensearch.action.index.IndexRequestBuilder;
|
18 |
| -import org.opensearch.action.search.SearchResponse; |
19 | 18 | import org.opensearch.action.support.master.AcknowledgedResponse;
|
20 | 19 | import org.opensearch.client.Client;
|
21 | 20 | import org.opensearch.cluster.ClusterState;
|
|
31 | 30 | import org.opensearch.env.NodeEnvironment;
|
32 | 31 | import org.opensearch.index.Index;
|
33 | 32 | import org.opensearch.index.IndexNotFoundException;
|
34 |
| -import org.opensearch.index.query.QueryBuilders; |
35 | 33 | import org.opensearch.index.store.remote.file.CleanerDaemonThreadLeakFilter;
|
36 | 34 | import org.opensearch.index.store.remote.filecache.FileCacheStats;
|
37 | 35 | import org.opensearch.monitor.fs.FsInfo;
|
|
53 | 51 | import static org.hamcrest.Matchers.notNullValue;
|
54 | 52 | import static org.opensearch.action.admin.cluster.node.stats.NodesStatsRequest.Metric.FS;
|
55 | 53 | import static org.opensearch.common.util.CollectionUtils.iterableAsArrayList;
|
56 |
| -import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount; |
57 | 54 |
|
58 | 55 | @ThreadLeakFilters(filters = CleanerDaemonThreadLeakFilter.class)
|
59 | 56 | public final class SearchableSnapshotIT extends AbstractSnapshotIntegTestCase {
|
@@ -545,27 +542,20 @@ public void testPruneFileCacheOnIndexDeletion() throws Exception {
|
545 | 542 | assertAllNodesFileCacheEmpty();
|
546 | 543 | }
|
547 | 544 |
|
548 |
| - @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/6686") |
549 | 545 | public void testCacheFilesAreClosedAfterUse() throws Exception {
|
550 | 546 | final int numReplicasIndex = randomIntBetween(1, 4);
|
551 | 547 | final String indexName = "test-idx";
|
552 | 548 | final String restoredIndexName = indexName + "-copy";
|
553 | 549 | final String repoName = "test-repo";
|
554 | 550 | final String snapshotName = "test-snap";
|
555 |
| - final String id = randomAlphaOfLength(5); |
556 | 551 | final Client client = client();
|
557 | 552 |
|
558 | 553 | internalCluster().ensureAtLeastNumSearchAndDataNodes(numReplicasIndex + 1);
|
559 |
| - createIndex(indexName); |
560 |
| - client().prepareIndex(indexName).setId(id).setSource("field", "test").get(); |
561 |
| - ensureGreen(); |
| 554 | + createIndexWithDocsAndEnsureGreen(1, 100, indexName); |
562 | 555 | createRepositoryWithSettings(null, repoName);
|
563 | 556 | takeSnapshot(client, snapshotName, repoName, indexName);
|
564 | 557 | restoreSnapshotAndEnsureGreen(client, snapshotName, repoName);
|
565 |
| - |
566 |
| - // Search document to make the index fetch data from the remote snapshot to local storage |
567 |
| - SearchResponse searchResponse = client().prepareSearch(restoredIndexName).setQuery(QueryBuilders.termQuery("field", "test")).get(); |
568 |
| - assertHitCount(searchResponse, 1); |
| 558 | + assertDocCount(restoredIndexName, 100L); |
569 | 559 |
|
570 | 560 | // The local cache files should be closed by deleting the restored index
|
571 | 561 | deleteIndicesAndEnsureGreen(client, restoredIndexName);
|
|
0 commit comments