Skip to content

Commit

Permalink
rename variable and add comment
Browse files Browse the repository at this point in the history
Signed-off-by: Kaituo Li <[email protected]>
  • Loading branch information
kaituo committed May 2, 2023
1 parent dd1eaef commit a50d2ba
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/test/java/org/opensearch/ad/TestHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -1508,9 +1508,9 @@ public static DetectorValidationIssue randomDetectorValidationIssueWithDetectorI
}

public static ClusterState createClusterState() {
final Map<String, IndexMetadata> immutableOpenMap = new HashMap<>();
final Map<String, IndexMetadata> mappings = new HashMap<>();

immutableOpenMap
mappings
.put(
ANOMALY_DETECTOR_JOB_INDEX,
IndexMetadata
Expand All @@ -1524,7 +1524,11 @@ public static ClusterState createClusterState() {
)
.build()
);
Metadata metaData = Metadata.builder().indices(Collections.unmodifiableMap(immutableOpenMap)).build();

// The usage of Collections.unmodifiableMap is due to replacing ImmutableOpenMap
// with java.util.Map in the core (refer to https://tinyurl.com/5fjdccs3 and https://tinyurl.com/5fjdccs3)
// The meaning and logic of the code stay the same.
Metadata metaData = Metadata.builder().indices(Collections.unmodifiableMap(mappings)).build();
ClusterState clusterState = new ClusterState(
new ClusterName("test_name"),
1l,
Expand Down

0 comments on commit a50d2ba

Please sign in to comment.