@@ -260,6 +260,8 @@ public static boolean hasXPack() {
260
260
*/
261
261
private static RestClient cleanupClient ;
262
262
263
+ private static boolean multiProjectEnabled ;
264
+
263
265
public enum ProductFeature {
264
266
XPACK ,
265
267
ILM ,
@@ -370,6 +372,7 @@ public void initClient() throws IOException {
370
372
availableFeatures = EnumSet .of (ProductFeature .LEGACY_TEMPLATES );
371
373
Set <String > versions = new HashSet <>();
372
374
boolean serverless = false ;
375
+ String multiProjectPluginVariant = null ;
373
376
374
377
for (Map <?, ?> nodeInfo : getNodesInfo (adminClient ).values ()) {
375
378
var nodeVersion = nodeInfo .get ("version" ).toString ();
@@ -399,6 +402,11 @@ public void initClient() throws IOException {
399
402
if (moduleName .startsWith ("serverless-" )) {
400
403
serverless = true ;
401
404
}
405
+ if (moduleName .contains ("test-multi-project" )) {
406
+ multiProjectPluginVariant = "test" ;
407
+ } else if (moduleName .contains ("serverless-multi-project" )) {
408
+ multiProjectPluginVariant = "serverless" ;
409
+ }
402
410
}
403
411
if (serverless ) {
404
412
availableFeatures .removeAll (
@@ -420,6 +428,18 @@ public void initClient() throws IOException {
420
428
.collect (Collectors .toSet ());
421
429
assert semanticNodeVersions .isEmpty () == false || serverless ;
422
430
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
+
423
443
testFeatureService = createTestFeatureService (getClusterStateFeatures (adminClient ), semanticNodeVersions );
424
444
}
425
445
@@ -2380,6 +2400,9 @@ public void ensurePeerRecoveryRetentionLeasesRenewedAndSynced(String index) thro
2380
2400
protected static Map <String , Set <String >> getClusterStateFeatures (RestClient adminClient ) throws IOException {
2381
2401
final Request request = new Request ("GET" , "_cluster/state" );
2382
2402
request .addParameter ("filter_path" , "nodes_features" );
2403
+ if (multiProjectEnabled ) {
2404
+ request .addParameter ("multi_project" , "true" );
2405
+ }
2383
2406
2384
2407
final Response response = adminClient .performRequest (request );
2385
2408
0 commit comments