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

Replace internal usages of 'master' term in 'test' directory #3283

Merged
merged 8 commits into from
May 11, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected Map<String, Function<Map<String, Object>, Object>> pluginScripts() {

public void testFailureInConditionalProcessor() {
internalCluster().ensureAtLeastNumDataNodes(1);
internalCluster().startMasterOnlyNode();
internalCluster().startClusterManagerOnlyNode();
final String pipelineId = "foo";
client().admin()
.cluster()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected boolean addMockHttpTransport() {
}

public void testRollingRestartOfTwoNodeCluster() throws Exception {
internalCluster().setBootstrapMasterNodeIndex(1);
internalCluster().setBootstrapClusterManagerNodeIndex(1);
final List<String> nodes = internalCluster().startNodes(2);
createIndex(
"test",
Expand Down Expand Up @@ -135,7 +135,7 @@ public Settings onNodeStopped(String nodeName) throws IOException {
}

public void testClearVotingTombstonesNotWaitingForRemoval() throws Exception {
internalCluster().setBootstrapMasterNodeIndex(2);
internalCluster().setBootstrapClusterManagerNodeIndex(2);
List<String> nodes = internalCluster().startNodes(3);
ensureStableCluster(3);
RestClient restClient = getRestClient();
Expand All @@ -150,7 +150,7 @@ public void testClearVotingTombstonesNotWaitingForRemoval() throws Exception {
}

public void testClearVotingTombstonesWaitingForRemoval() throws Exception {
internalCluster().setBootstrapMasterNodeIndex(2);
internalCluster().setBootstrapClusterManagerNodeIndex(2);
List<String> nodes = internalCluster().startNodes(3);
ensureStableCluster(3);
RestClient restClient = getRestClient();
Expand All @@ -165,7 +165,7 @@ public void testClearVotingTombstonesWaitingForRemoval() throws Exception {
}

public void testFailsOnUnknownNode() throws Exception {
internalCluster().setBootstrapMasterNodeIndex(2);
internalCluster().setBootstrapClusterManagerNodeIndex(2);
internalCluster().startNodes(3);
ensureStableCluster(3);
RestClient restClient = getRestClient();
Expand All @@ -182,7 +182,7 @@ public void testFailsOnUnknownNode() throws Exception {
}

public void testRemoveTwoNodesAtOnce() throws Exception {
internalCluster().setBootstrapMasterNodeIndex(2);
internalCluster().setBootstrapClusterManagerNodeIndex(2);
List<String> nodes = internalCluster().startNodes(3);
ensureStableCluster(3);
RestClient restClient = getRestClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected Settings nodeSettings(int nodeOrdinal) {

public void testJoin() {
// start master node
final String masterNode = internalCluster().startMasterOnlyNode();
final String masterNode = internalCluster().startClusterManagerOnlyNode();
registerGceNode(masterNode);

ClusterStateResponse clusterStateResponse = client(masterNode).admin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private Settings buildSettings(int maxTombstones) {
* Check that when dangling indices are discovered, then they can be listed via the REST API.
*/
public void testDanglingIndicesCanBeListed() throws Exception {
internalCluster().setBootstrapMasterNodeIndex(1);
internalCluster().setBootstrapClusterManagerNodeIndex(1);
internalCluster().startNodes(3, buildSettings(0));

final DanglingIndexDetails danglingIndexDetails = createDanglingIndices(INDEX_NAME);
Expand Down Expand Up @@ -121,7 +121,7 @@ public void testDanglingIndicesCanBeListed() throws Exception {
* Check that dangling indices can be imported.
*/
public void testDanglingIndicesCanBeImported() throws Exception {
internalCluster().setBootstrapMasterNodeIndex(1);
internalCluster().setBootstrapClusterManagerNodeIndex(1);
internalCluster().startNodes(3, buildSettings(0));

createDanglingIndices(INDEX_NAME);
Expand Down Expand Up @@ -157,7 +157,7 @@ public void testDanglingIndicesCanBeImported() throws Exception {
* deleted through the API
*/
public void testDanglingIndicesCanBeDeleted() throws Exception {
internalCluster().setBootstrapMasterNodeIndex(1);
internalCluster().setBootstrapClusterManagerNodeIndex(1);
internalCluster().startNodes(3, buildSettings(1));

createDanglingIndices(INDEX_NAME, OTHER_INDEX_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
}

public void testNodesInfoTimeout() {
String masterNode = internalCluster().startMasterOnlyNode();
String clusterManagerNode = internalCluster().startClusterManagerOnlyNode();
String dataNode = internalCluster().startDataOnlyNode();
String anotherDataNode = internalCluster().startDataOnlyNode();

Expand All @@ -65,11 +65,11 @@ public void testNodesInfoTimeout() {
nodes.add(node.getNode().getName());
}
assertThat(response.getNodes().size(), equalTo(2));
assertThat(nodes.contains(masterNode), is(true));
assertThat(nodes.contains(clusterManagerNode), is(true));
}

public void testNodesStatsTimeout() {
String masterNode = internalCluster().startMasterOnlyNode();
String clusterManagerNode = internalCluster().startClusterManagerOnlyNode();
String dataNode = internalCluster().startDataOnlyNode();
String anotherDataNode = internalCluster().startDataOnlyNode();
TimeValue timeout = TimeValue.timeValueMillis(1000);
Expand All @@ -87,11 +87,11 @@ public void testNodesStatsTimeout() {
nodes.add(node.getNode().getName());
}
assertThat(response.getNodes().size(), equalTo(2));
assertThat(nodes.contains(masterNode), is(true));
assertThat(nodes.contains(clusterManagerNode), is(true));
}

public void testListTasksTimeout() {
String masterNode = internalCluster().startMasterOnlyNode();
String clusterManagerNode = internalCluster().startClusterManagerOnlyNode();
String dataNode = internalCluster().startDataOnlyNode();
String anotherDataNode = internalCluster().startDataOnlyNode();
TimeValue timeout = TimeValue.timeValueMillis(1000);
Expand All @@ -108,7 +108,7 @@ public void testListTasksTimeout() {
}

public void testRecoveriesWithTimeout() {
internalCluster().startMasterOnlyNode();
internalCluster().startClusterManagerOnlyNode();
String dataNode = internalCluster().startDataOnlyNode();
String anotherDataNode = internalCluster().startDataOnlyNode();

Expand Down Expand Up @@ -148,7 +148,7 @@ public void testRecoveriesWithTimeout() {
}

public void testStatsWithTimeout() {
internalCluster().startMasterOnlyNode();
internalCluster().startClusterManagerOnlyNode();
String dataNode = internalCluster().startDataOnlyNode();
String anotherDataNode = internalCluster().startDataOnlyNode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ public void testAssignedReplicaOnSpecificNode() throws Exception {

public void testCannotAllocateStaleReplicaExplanation() throws Exception {
logger.info("--> starting 3 nodes");
final String masterNode = internalCluster().startNode();
final String clusterManagerNode = internalCluster().startNode();
// start replica node first, so it's path will be used first when we start a node after
// stopping all of them at end of test.
final String replicaNode = internalCluster().startNode();
Expand All @@ -1123,7 +1123,7 @@ public void testCannotAllocateStaleReplicaExplanation() throws Exception {
1,
Settings.builder()
.put("index.routing.allocation.include._name", primaryNode)
.put("index.routing.allocation.exclude._name", masterNode)
.put("index.routing.allocation.exclude._name", clusterManagerNode)
.build(),
ActiveShardCount.ONE
);
Expand Down Expand Up @@ -1165,7 +1165,7 @@ public void testCannotAllocateStaleReplicaExplanation() throws Exception {

logger.info("--> restart the node with the stale replica");
String restartedNode = internalCluster().startDataOnlyNode(replicaDataPathSettings);
ensureClusterSizeConsistency(); // wait for the master to finish processing join.
ensureClusterSizeConsistency(); // wait for the cluster-manager to finish processing join.

// wait until the system has fetched shard data and we know there is no valid shard copy
assertBusy(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
/**
* Integration tests for task management API
* <p>
* We need at least 2 nodes so we have a master node a non-master node
* We need at least 2 nodes so we have a cluster-manager node a non-cluster-manager node
*/
@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.SUITE, minNumDataNodes = 2)
public class TasksIT extends OpenSearchIntegTestCase {
Expand Down Expand Up @@ -154,17 +154,17 @@ public void testTaskCounts() {
assertThat(response.getTasks().size(), greaterThanOrEqualTo(cluster().numDataNodes()));
}

public void testMasterNodeOperationTasks() {
public void testClusterManagerNodeOperationTasks() {
registerTaskManagerListeners(ClusterHealthAction.NAME);

// First run the health on the master node - should produce only one task on the master node
// First run the health on the cluster-manager node - should produce only one task on the cluster-manager node
internalCluster().masterClient().admin().cluster().prepareHealth().get();
assertEquals(1, numberOfEvents(ClusterHealthAction.NAME, Tuple::v1)); // counting only registration events
assertEquals(1, numberOfEvents(ClusterHealthAction.NAME, event -> event.v1() == false)); // counting only unregistration events

resetTaskManagerListeners(ClusterHealthAction.NAME);

// Now run the health on a non-master node - should produce one task on master and one task on another node
// Now run the health on a non-cluster-manager node - should produce one task on cluster-manager and one task on another node
internalCluster().nonMasterClient().admin().cluster().prepareHealth().get();
assertEquals(2, numberOfEvents(ClusterHealthAction.NAME, Tuple::v1)); // counting only registration events
assertEquals(2, numberOfEvents(ClusterHealthAction.NAME, event -> event.v1() == false)); // counting only unregistration events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singletonList(MockTransportService.TestPlugin.class);
}

public void testNonLocalRequestAlwaysFindsMaster() throws Exception {
runRepeatedlyWhileChangingMaster(() -> {
public void testNonLocalRequestAlwaysFindsClusterManager() throws Exception {
runRepeatedlyWhileChangingClusterManager(() -> {
final ClusterStateRequestBuilder clusterStateRequestBuilder = client().admin()
.cluster()
.prepareState()
Expand All @@ -82,12 +82,12 @@ public void testNonLocalRequestAlwaysFindsMaster() throws Exception {
} catch (MasterNotDiscoveredException e) {
return; // ok, we hit the disconnected node
}
assertNotNull("should always contain a master node", clusterStateResponse.getState().nodes().getMasterNodeId());
assertNotNull("should always contain a cluster-manager node", clusterStateResponse.getState().nodes().getMasterNodeId());
});
}

public void testLocalRequestAlwaysSucceeds() throws Exception {
runRepeatedlyWhileChangingMaster(() -> {
runRepeatedlyWhileChangingClusterManager(() -> {
final String node = randomFrom(internalCluster().getNodeNames());
final DiscoveryNodes discoveryNodes = client(node).admin()
.cluster()
Expand All @@ -108,8 +108,8 @@ public void testLocalRequestAlwaysSucceeds() throws Exception {
});
}

public void testNonLocalRequestAlwaysFindsMasterAndWaitsForMetadata() throws Exception {
runRepeatedlyWhileChangingMaster(() -> {
public void testNonLocalRequestAlwaysFindsClusterManagerAndWaitsForMetadata() throws Exception {
runRepeatedlyWhileChangingClusterManager(() -> {
final String node = randomFrom(internalCluster().getNodeNames());
final long metadataVersion = internalCluster().getInstance(ClusterService.class, node)
.getClusterApplierService()
Expand All @@ -134,14 +134,14 @@ public void testNonLocalRequestAlwaysFindsMasterAndWaitsForMetadata() throws Exc
}
if (clusterStateResponse.isWaitForTimedOut() == false) {
final ClusterState state = clusterStateResponse.getState();
assertNotNull("should always contain a master node", state.nodes().getMasterNodeId());
assertNotNull("should always contain a cluster-manager node", state.nodes().getMasterNodeId());
assertThat("waited for metadata version", state.metadata().version(), greaterThanOrEqualTo(waitForMetadataVersion));
}
});
}

public void testLocalRequestWaitsForMetadata() throws Exception {
runRepeatedlyWhileChangingMaster(() -> {
runRepeatedlyWhileChangingClusterManager(() -> {
final String node = randomFrom(internalCluster().getNodeNames());
final long metadataVersion = internalCluster().getInstance(ClusterService.class, node)
.getClusterApplierService()
Expand Down Expand Up @@ -170,7 +170,7 @@ public void testLocalRequestWaitsForMetadata() throws Exception {
});
}

public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception {
public void runRepeatedlyWhileChangingClusterManager(Runnable runnable) throws Exception {
internalCluster().startNodes(3);

assertBusy(
Expand All @@ -191,7 +191,7 @@ public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception
)
);

final String masterName = internalCluster().getMasterName();
final String clusterManagerName = internalCluster().getMasterName();

final AtomicBoolean shutdown = new AtomicBoolean();
final Thread assertingThread = new Thread(() -> {
Expand All @@ -204,9 +204,12 @@ public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception
String value = "none";
while (shutdown.get() == false) {
value = "none".equals(value) ? "all" : "none";
final String nonMasterNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames()));
final String nonClusterManagerNode = randomValueOtherThan(
clusterManagerName,
() -> randomFrom(internalCluster().getNodeNames())
);
assertAcked(
client(nonMasterNode).admin()
client(nonClusterManagerNode).admin()
.cluster()
.prepareUpdateSettings()
.setPersistentSettings(Settings.builder().put(CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), value))
Expand All @@ -222,22 +225,25 @@ public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception
assertingThread.start();
updatingThread.start();

final MockTransportService masterTransportService = (MockTransportService) internalCluster().getInstance(
final MockTransportService clusterManagerTransportService = (MockTransportService) internalCluster().getInstance(
TransportService.class,
masterName
clusterManagerName
);

for (MockTransportService mockTransportService : mockTransportServices) {
if (masterTransportService != mockTransportService) {
masterTransportService.addFailToSendNoConnectRule(mockTransportService);
mockTransportService.addFailToSendNoConnectRule(masterTransportService);
if (clusterManagerTransportService != mockTransportService) {
clusterManagerTransportService.addFailToSendNoConnectRule(mockTransportService);
mockTransportService.addFailToSendNoConnectRule(clusterManagerTransportService);
}
}

assertBusy(() -> {
final String nonMasterNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames()));
final String claimedMasterName = internalCluster().getMasterName(nonMasterNode);
assertThat(claimedMasterName, not(equalTo(masterName)));
final String nonClusterManagerNode = randomValueOtherThan(
clusterManagerName,
() -> randomFrom(internalCluster().getNodeNames())
);
final String claimedClusterManagerName = internalCluster().getMasterName(nonClusterManagerNode);
assertThat(claimedClusterManagerName, not(equalTo(clusterManagerName)));
});

shutdown.set(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testNodeCounts() {
for (int i = 0; i < numNodes; i++) {
boolean isDataNode = randomBoolean();
boolean isIngestNode = randomBoolean();
boolean isMasterNode = randomBoolean();
boolean isClusterManagerNode = randomBoolean();
boolean isRemoteClusterClientNode = false;
final Set<DiscoveryNodeRole> roles = new HashSet<>();
if (isDataNode) {
Expand All @@ -106,7 +106,7 @@ public void testNodeCounts() {
if (isIngestNode) {
roles.add(DiscoveryNodeRole.INGEST_ROLE);
}
if (isMasterNode) {
if (isClusterManagerNode) {
roles.add(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE);
}
if (isRemoteClusterClientNode) {
Expand All @@ -128,14 +128,14 @@ public void testNodeCounts() {
if (isIngestNode) {
incrementCountForRole(DiscoveryNodeRole.INGEST_ROLE.roleName(), expectedCounts);
}
if (isMasterNode) {
if (isClusterManagerNode) {
incrementCountForRole(DiscoveryNodeRole.MASTER_ROLE.roleName(), expectedCounts);
incrementCountForRole(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE.roleName(), expectedCounts);
}
if (isRemoteClusterClientNode) {
incrementCountForRole(DiscoveryNodeRole.REMOTE_CLUSTER_CLIENT_ROLE.roleName(), expectedCounts);
}
if (!isDataNode && !isMasterNode && !isIngestNode && !isRemoteClusterClientNode) {
if (!isDataNode && !isClusterManagerNode && !isIngestNode && !isRemoteClusterClientNode) {
incrementCountForRole(ClusterStatsNodes.Counts.COORDINATING_ONLY, expectedCounts);
}

Expand Down Expand Up @@ -254,12 +254,12 @@ public void testAllocatedProcessors() throws Exception {
}

public void testClusterStatusWhenStateNotRecovered() throws Exception {
internalCluster().startMasterOnlyNode(Settings.builder().put("gateway.recover_after_nodes", 2).build());
internalCluster().startClusterManagerOnlyNode(Settings.builder().put("gateway.recover_after_nodes", 2).build());
ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get();
assertThat(response.getStatus(), equalTo(ClusterHealthStatus.RED));

if (randomBoolean()) {
internalCluster().startMasterOnlyNode();
internalCluster().startClusterManagerOnlyNode();
} else {
internalCluster().startDataOnlyNode();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
public class IndicesExistsIT extends OpenSearchIntegTestCase {

public void testIndexExistsWithBlocksInPlace() throws IOException {
internalCluster().setBootstrapMasterNodeIndex(0);
internalCluster().setBootstrapClusterManagerNodeIndex(0);
Settings settings = Settings.builder().put(GatewayService.RECOVER_AFTER_NODES_SETTING.getKey(), 99).build();
String node = internalCluster().startNode(settings);

Expand Down
Loading