Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for RemoteGlobalMetadataManager #14394

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.gateway.remote;

import org.opensearch.core.action.ActionListener;

public class RemoteStateTestUtil {
shiv0408 marked this conversation as resolved.
Show resolved Hide resolved
public static class TestCapturingListener<T> implements ActionListener<T> {
T result;
Exception failure;

@Override
public void onResponse(T result) {
this.result = result;
}

@Override
public void onFailure(Exception e) {
this.failure = e;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public void testSerDe() throws IOException {
}
}

private CoordinationMetadata getCoordinationMetadata() {
public static CoordinationMetadata getCoordinationMetadata() {
return CoordinationMetadata.builder()
.term(TERM)
.lastAcceptedConfiguration(new VotingConfiguration(Set.of("node1")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public void testSerDe() throws IOException {
}
}

private Custom getCustomMetadata() {
public static Custom getCustomMetadata() {
return IndexGraveyard.builder().addTombstone(new Index("test-index", "3q2423")).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void testSerDe() throws IOException {
}
}

private Metadata getGlobalMetadata() {
public static Metadata getGlobalMetadata() {
return Metadata.builder()
.templates(
TemplatesMetadata.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void testSerDe() throws IOException {
}
}

private DiffableStringMap getHashesOfConsistentSettings() {
public static DiffableStringMap getHashesOfConsistentSettings() {
Map<String, String> hashesOfConsistentSettings = new HashMap<>();
hashesOfConsistentSettings.put("secure-setting-key", "secure-setting-value");
return new DiffableStringMap(hashesOfConsistentSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public void testSerDe() throws IOException {
}
}

private Settings getSettings() {
public static Settings getSettings() {
return Settings.builder().put("random_index_setting_" + randomAlphaOfLength(3), randomAlphaOfLength(5)).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void testSerDe() throws IOException {
}
}

private TemplatesMetadata getTemplatesMetadata() {
public static TemplatesMetadata getTemplatesMetadata() {
return TemplatesMetadata.builder()
.put(
IndexTemplateMetadata.builder("template" + randomAlphaOfLength(3))
Expand Down
Loading