Skip to content

Commit 17641f6

Browse files
authored
Remove duplicate methods from RemoteStoreBaseIntegTestCase (opensearch-project#13044)
Signed-off-by: Sachin Kale <kalsac@amazon.com>
1 parent e8c5daf commit 17641f6

File tree

2 files changed

+1
-120
lines changed

2 files changed

+1
-120
lines changed

server/src/internalClusterTest/java/org/opensearch/remotestore/RemoteStoreBaseIntegTestCase.java

-119
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.opensearch.cluster.service.ClusterService;
2929
import org.opensearch.common.UUIDs;
3030
import org.opensearch.common.settings.Settings;
31-
import org.opensearch.core.common.unit.ByteSizeUnit;
3231
import org.opensearch.core.index.Index;
3332
import org.opensearch.index.IndexModule;
3433
import org.opensearch.index.IndexService;
@@ -57,11 +56,8 @@
5756
import java.util.concurrent.atomic.AtomicInteger;
5857
import java.util.stream.Collectors;
5958

60-
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY;
6159
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_REPOSITORY_SETTINGS_ATTRIBUTE_KEY_PREFIX;
6260
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_REPOSITORY_TYPE_ATTRIBUTE_KEY_FORMAT;
63-
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY;
64-
import static org.opensearch.node.remotestore.RemoteStoreNodeAttribute.REMOTE_STORE_TRANSLOG_REPOSITORY_NAME_ATTRIBUTE_KEY;
6561
import static org.opensearch.repositories.fs.ReloadableFsRepository.REPOSITORIES_FAILRATE_SETTING;
6662
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
6763

@@ -191,121 +187,6 @@ protected BulkResponse indexBulk(String indexName, int numDocs) {
191187
return client().bulk(bulkRequest).actionGet();
192188
}
193189

194-
public static Settings remoteStoreClusterSettings(String name, Path path) {
195-
return remoteStoreClusterSettings(name, path, name, path);
196-
}
197-
198-
public static Settings remoteStoreClusterSettings(
199-
String segmentRepoName,
200-
Path segmentRepoPath,
201-
String segmentRepoType,
202-
String translogRepoName,
203-
Path translogRepoPath,
204-
String translogRepoType
205-
) {
206-
Settings.Builder settingsBuilder = Settings.builder();
207-
settingsBuilder.put(
208-
buildRemoteStoreNodeAttributes(
209-
segmentRepoName,
210-
segmentRepoPath,
211-
segmentRepoType,
212-
translogRepoName,
213-
translogRepoPath,
214-
translogRepoType,
215-
false
216-
)
217-
);
218-
return settingsBuilder.build();
219-
}
220-
221-
public static Settings remoteStoreClusterSettings(
222-
String segmentRepoName,
223-
Path segmentRepoPath,
224-
String translogRepoName,
225-
Path translogRepoPath
226-
) {
227-
Settings.Builder settingsBuilder = Settings.builder();
228-
settingsBuilder.put(buildRemoteStoreNodeAttributes(segmentRepoName, segmentRepoPath, translogRepoName, translogRepoPath, false));
229-
return settingsBuilder.build();
230-
}
231-
232-
public static Settings buildRemoteStoreNodeAttributes(
233-
String segmentRepoName,
234-
Path segmentRepoPath,
235-
String translogRepoName,
236-
Path translogRepoPath,
237-
boolean withRateLimiterAttributes
238-
) {
239-
return buildRemoteStoreNodeAttributes(
240-
segmentRepoName,
241-
segmentRepoPath,
242-
ReloadableFsRepository.TYPE,
243-
translogRepoName,
244-
translogRepoPath,
245-
ReloadableFsRepository.TYPE,
246-
withRateLimiterAttributes
247-
);
248-
}
249-
250-
public static Settings buildRemoteStoreNodeAttributes(
251-
String segmentRepoName,
252-
Path segmentRepoPath,
253-
String segmentRepoType,
254-
String translogRepoName,
255-
Path translogRepoPath,
256-
String translogRepoType,
257-
boolean withRateLimiterAttributes
258-
) {
259-
String segmentRepoTypeAttributeKey = String.format(
260-
Locale.getDefault(),
261-
"node.attr." + REMOTE_STORE_REPOSITORY_TYPE_ATTRIBUTE_KEY_FORMAT,
262-
segmentRepoName
263-
);
264-
String segmentRepoSettingsAttributeKeyPrefix = String.format(
265-
Locale.getDefault(),
266-
"node.attr." + REMOTE_STORE_REPOSITORY_SETTINGS_ATTRIBUTE_KEY_PREFIX,
267-
segmentRepoName
268-
);
269-
String translogRepoTypeAttributeKey = String.format(
270-
Locale.getDefault(),
271-
"node.attr." + REMOTE_STORE_REPOSITORY_TYPE_ATTRIBUTE_KEY_FORMAT,
272-
translogRepoName
273-
);
274-
String translogRepoSettingsAttributeKeyPrefix = String.format(
275-
Locale.getDefault(),
276-
"node.attr." + REMOTE_STORE_REPOSITORY_SETTINGS_ATTRIBUTE_KEY_PREFIX,
277-
translogRepoName
278-
);
279-
String stateRepoTypeAttributeKey = String.format(
280-
Locale.getDefault(),
281-
"node.attr." + REMOTE_STORE_REPOSITORY_TYPE_ATTRIBUTE_KEY_FORMAT,
282-
segmentRepoName
283-
);
284-
String stateRepoSettingsAttributeKeyPrefix = String.format(
285-
Locale.getDefault(),
286-
"node.attr." + REMOTE_STORE_REPOSITORY_SETTINGS_ATTRIBUTE_KEY_PREFIX,
287-
segmentRepoName
288-
);
289-
290-
Settings.Builder settings = Settings.builder()
291-
.put("node.attr." + REMOTE_STORE_SEGMENT_REPOSITORY_NAME_ATTRIBUTE_KEY, segmentRepoName)
292-
.put(segmentRepoTypeAttributeKey, segmentRepoType)
293-
.put(segmentRepoSettingsAttributeKeyPrefix + "location", segmentRepoPath)
294-
.put("node.attr." + REMOTE_STORE_TRANSLOG_REPOSITORY_NAME_ATTRIBUTE_KEY, translogRepoName)
295-
.put(translogRepoTypeAttributeKey, translogRepoType)
296-
.put(translogRepoSettingsAttributeKeyPrefix + "location", translogRepoPath)
297-
.put("node.attr." + REMOTE_STORE_CLUSTER_STATE_REPOSITORY_NAME_ATTRIBUTE_KEY, segmentRepoName)
298-
.put(stateRepoTypeAttributeKey, segmentRepoType)
299-
.put(stateRepoSettingsAttributeKeyPrefix + "location", segmentRepoPath);
300-
301-
if (withRateLimiterAttributes) {
302-
settings.put(segmentRepoSettingsAttributeKeyPrefix + "compress", randomBoolean())
303-
.put(segmentRepoSettingsAttributeKeyPrefix + "chunk_size", 200, ByteSizeUnit.BYTES);
304-
}
305-
306-
return settings.build();
307-
}
308-
309190
Settings defaultIndexSettings() {
310191
return Settings.builder()
311192
.put(super.indexSettings())

test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2538,7 +2538,7 @@ public static Settings buildRemoteStoreNodeAttributes(
25382538
);
25392539
}
25402540

2541-
public static Settings buildRemoteStoreNodeAttributes(
2541+
private static Settings buildRemoteStoreNodeAttributes(
25422542
String segmentRepoName,
25432543
Path segmentRepoPath,
25442544
String segmentRepoType,

0 commit comments

Comments
 (0)