| 
33 | 33 | import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;  | 
34 | 34 | import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;  | 
35 | 35 | import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;  | 
 | 36 | +import org.elasticsearch.action.admin.cluster.state.ClusterStateRequestBuilder;  | 
36 | 37 | import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;  | 
37 | 38 | import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;  | 
38 | 39 | import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;  | 
@@ -1397,12 +1398,13 @@ protected final void doEnsureClusterStateConsistency(NamedWriteableRegistry name  | 
1397 | 1398 |         final var masterName = internalCluster().getMasterName();  | 
1398 | 1399 |         for (Client client : cluster().getClients()) {  | 
1399 | 1400 |             localStates.add(  | 
1400 |  | -                SubscribableListener.newForked(l -> client.admin().cluster().prepareState(TEST_REQUEST_TIMEOUT).all().execute(l))  | 
 | 1401 | +                SubscribableListener.newForked(l -> prepareClusterStateRequest(client)  | 
 | 1402 | +                    .execute(l))  | 
1401 | 1403 |             );  | 
1402 | 1404 |         }  | 
1403 | 1405 |         try (RefCountingListener refCountingListener = new RefCountingListener(future)) {  | 
1404 | 1406 |             SubscribableListener.<ClusterStateResponse>newForked(  | 
1405 |  | -                l -> client(masterName).admin().cluster().prepareState(TEST_REQUEST_TIMEOUT).all().execute(l)  | 
 | 1407 | +                l -> prepareClusterStateRequest(client(masterName)).execute(l)  | 
1406 | 1408 |             ).andThenAccept(masterStateResponse -> {  | 
1407 | 1409 |                 byte[] masterClusterStateBytes = ClusterState.Builder.toBytes(masterStateResponse.getState());  | 
1408 | 1410 |                 // remove local node reference  | 
@@ -1462,7 +1464,7 @@ protected final void doEnsureClusterStateConsistency(NamedWriteableRegistry name  | 
1462 | 1464 |     protected void ensureClusterStateCanBeReadByNodeTool() throws IOException {  | 
1463 | 1465 |         if (cluster() != null && cluster().size() > 0) {  | 
1464 | 1466 |             final Client masterClient = client();  | 
1465 |  | -            Metadata metadata = masterClient.admin().cluster().prepareState(TEST_REQUEST_TIMEOUT).all().get().getState().metadata();  | 
 | 1467 | +            Metadata metadata = prepareClusterStateRequest(masterClient).get().getState().metadata();  | 
1466 | 1468 |             final Map<String, String> serializationParams = Maps.newMapWithExpectedSize(2);  | 
1467 | 1469 |             serializationParams.put("binary", "true");  | 
1468 | 1470 |             serializationParams.put(Metadata.CONTEXT_MODE_PARAM, Metadata.CONTEXT_MODE_GATEWAY);  | 
@@ -1565,6 +1567,10 @@ protected void ensureClusterStateCanBeReadByNodeTool() throws IOException {  | 
1565 | 1567 |         }  | 
1566 | 1568 |     }  | 
1567 | 1569 | 
 
  | 
 | 1570 | +    private ClusterStateRequestBuilder prepareClusterStateRequest(Client client) {  | 
 | 1571 | +        return client.admin().cluster().prepareState(TEST_REQUEST_TIMEOUT).all().setMultiproject(multiProjectIntegrationTest());  | 
 | 1572 | +    }  | 
 | 1573 | + | 
1568 | 1574 |     private static void ensureClusterInfoServiceRunning() {  | 
1569 | 1575 |         if (isInternalCluster() && cluster().size() > 0) {  | 
1570 | 1576 |             // ensures that the cluster info service didn't leak its async task, which would prevent future refreshes  | 
 | 
0 commit comments