Skip to content

Commit

Permalink
Fixing disk health indicator unit tests (#90175)
Browse files Browse the repository at this point in the history
The disk health indicator unit tests had a couple of edge cases where
they could fail if all test nodes had a red status. This protects
against that.
  • Loading branch information
masseyke committed Sep 20, 2022
1 parent 4901cf8 commit f4dd48e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ public void testGetIndicesForNodes() {
Set<String> nonRedNodeIndices = new HashSet<>();
for (int i = 0; i < numberOfIndices; i++) {
String indexName = randomAlphaOfLength(20);
if (randomBoolean()) {
if (nonRedNodeIds.isEmpty() || randomBoolean()) {
indexNameToNodeIdsMap.put(indexName, redNodeIds);
redNodeIndices.add(indexName);
} else {
Expand Down Expand Up @@ -775,7 +775,7 @@ public void testGetNodeIdsForIndices() {
Set<String> nonRedNodeIndices = new HashSet<>();
for (int i = 0; i < numberOfIndices; i++) {
String indexName = randomAlphaOfLength(20);
if (randomBoolean()) {
if (nonRedNodeIds.isEmpty() || randomBoolean()) {
indexNameToNodeIdsMap.put(indexName, redNodeIds);
redNodeIndices.add(indexName);
} else {
Expand Down

0 comments on commit f4dd48e

Please sign in to comment.