Skip to content

Commit

Permalink
Fix randomization in MlNodeShutdownIT (#77281)
Browse files Browse the repository at this point in the history
This commit fixes the randomization in MlNodeShutdownIT to ensure that
the required values for the selected shutdown type are all present.
  • Loading branch information
gwbrown authored Sep 3, 2021
1 parent b2a9328 commit 55e543a
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ public void testJobsVacateShuttingDownNode() throws Exception {
});

// Call the shutdown API for the chosen node.
final SingleNodeShutdownMetadata.Type type = randomFrom(SingleNodeShutdownMetadata.Type.values());
final String targetNodeName = type == SingleNodeShutdownMetadata.Type.REPLACE ? randomAlphaOfLengthBetween(10, 20) : null;
client().execute(
PutShutdownNodeAction.INSTANCE,
new PutShutdownNodeAction.Request(
nodeIdToShutdown.get(),
randomFrom(SingleNodeShutdownMetadata.Type.values()),
"just testing",
null,
null)
targetNodeName)
).actionGet();

// Wait for the desired end state of all 6 jobs running on nodes that are not shutting down.
Expand Down Expand Up @@ -144,14 +146,15 @@ public void testCloseJobVacatingShuttingDownNode() throws Exception {
});

// Call the shutdown API for the chosen node.
final SingleNodeShutdownMetadata.Type type = randomFrom(SingleNodeShutdownMetadata.Type.values());
final String targetNodeName = type == SingleNodeShutdownMetadata.Type.REPLACE ? randomAlphaOfLengthBetween(10, 20) : null;
client().execute(
PutShutdownNodeAction.INSTANCE,
new PutShutdownNodeAction.Request(
nodeIdToShutdown.get(),
randomFrom(SingleNodeShutdownMetadata.Type.values()),
nodeIdToShutdown.get(), type,
"just testing",
null,
null)
targetNodeName)
)
.actionGet();

Expand Down

0 comments on commit 55e543a

Please sign in to comment.