@@ -260,6 +260,8 @@ public static boolean hasXPack() {
260260 */
261261 private static RestClient cleanupClient ;
262262
263+ private static boolean multiProjectEnabled ;
264+
263265 public enum ProductFeature {
264266 XPACK ,
265267 ILM ,
@@ -370,6 +372,7 @@ public void initClient() throws IOException {
370372 availableFeatures = EnumSet .of (ProductFeature .LEGACY_TEMPLATES );
371373 Set <String > versions = new HashSet <>();
372374 boolean serverless = false ;
375+ String multiProjectPluginVariant = null ;
373376
374377 for (Map <?, ?> nodeInfo : getNodesInfo (adminClient ).values ()) {
375378 var nodeVersion = nodeInfo .get ("version" ).toString ();
@@ -399,6 +402,11 @@ public void initClient() throws IOException {
399402 if (moduleName .startsWith ("serverless-" )) {
400403 serverless = true ;
401404 }
405+ if (moduleName .contains ("test-multi-project" )) {
406+ multiProjectPluginVariant = "test" ;
407+ } else if (moduleName .contains ("serverless-multi-project" )) {
408+ multiProjectPluginVariant = "serverless" ;
409+ }
402410 }
403411 if (serverless ) {
404412 availableFeatures .removeAll (
@@ -420,6 +428,18 @@ public void initClient() throws IOException {
420428 .collect (Collectors .toSet ());
421429 assert semanticNodeVersions .isEmpty () == false || serverless ;
422430
431+ if (multiProjectPluginVariant != null ) {
432+ final Request settingRequest = new Request (
433+ "GET" ,
434+ "/_cluster/settings?include_defaults&filter_path=*." + multiProjectPluginVariant + ".multi_project.enabled"
435+ );
436+ settingRequest .setOptions (RequestOptions .DEFAULT .toBuilder ().setWarningsHandler (WarningsHandler .PERMISSIVE ));
437+ final var response = entityAsMap (adminClient .performRequest (settingRequest ));
438+ multiProjectEnabled = Boolean .parseBoolean (
439+ ObjectPath .evaluate (response , "defaults." + multiProjectPluginVariant + ".multi_project.enabled" )
440+ );
441+ }
442+
423443 testFeatureService = createTestFeatureService (getClusterStateFeatures (adminClient ), semanticNodeVersions );
424444 }
425445
@@ -2380,6 +2400,9 @@ public void ensurePeerRecoveryRetentionLeasesRenewedAndSynced(String index) thro
23802400 protected static Map <String , Set <String >> getClusterStateFeatures (RestClient adminClient ) throws IOException {
23812401 final Request request = new Request ("GET" , "_cluster/state" );
23822402 request .addParameter ("filter_path" , "nodes_features" );
2403+ if (multiProjectEnabled ) {
2404+ request .addParameter ("multi_project" , "true" );
2405+ }
23832406
23842407 final Response response = adminClient .performRequest (request );
23852408
0 commit comments