@@ -369,7 +369,6 @@ public static void initializeProjectIds() {
369369 // The active project-id is slightly longer, and has a fixed prefix so that it's easier to pick in error messages etc.
370370 activeProject = "active00" + randomAlphaOfLength (8 ).toLowerCase (Locale .ROOT );
371371 extraProjects = randomSet (1 , 3 , () -> randomAlphaOfLength (12 ).toLowerCase (Locale .ROOT ));
372- // TODO do this in a different way
373372 multiProjectEnabled = Boolean .parseBoolean (System .getProperty ("test.multi_project.enabled" ));
374373 }
375374
@@ -383,6 +382,8 @@ public void initClient() throws IOException {
383382 assert testFeatureServiceInitialized () == false ;
384383 clusterHosts = parseClusterHosts (getTestRestCluster ());
385384 logger .info ("initializing REST clients against {}" , clusterHosts );
385+ // We add the project ID to the client settings afterward because a lot of subclasses don't call super.restClientSettings(),
386+ // meaning the project ID would be removed from the settings.
386387 var clientSettings = addProjectIdToSettings (restClientSettings ());
387388 var adminSettings = restAdminSettings ();
388389 var cleanupSettings = cleanupClientSettings ();
@@ -444,9 +445,9 @@ public void initClient() throws IOException {
444445 .collect (Collectors .toSet ());
445446 assert semanticNodeVersions .isEmpty () == false || serverless ;
446447 testFeatureService = createTestFeatureService (getClusterStateFeatures (adminClient ), semanticNodeVersions );
447- }
448448
449- configureProjects ();
449+ configureProjects ();
450+ }
450451
451452 assert testFeatureServiceInitialized ();
452453 assert client != null ;
0 commit comments