1818import org .apache .lucene .tests .util .TimeUnits ;
1919import org .elasticsearch .client .Node ;
2020import org .elasticsearch .client .Request ;
21- import org .elasticsearch .client .RequestOptions ;
2221import org .elasticsearch .client .Response ;
2322import org .elasticsearch .client .RestClient ;
2423import org .elasticsearch .client .RestClientBuilder ;
25- import org .elasticsearch .client .WarningsHandler ;
2624import org .elasticsearch .client .sniff .ElasticsearchNodesSniffer ;
27- import org .elasticsearch .cluster .metadata .IndexMetadata ;
2825import org .elasticsearch .common .Strings ;
2926import org .elasticsearch .common .settings .Settings ;
3027import org .elasticsearch .common .xcontent .support .XContentMapValues ;
4138import org .elasticsearch .test .rest .yaml .section .ExecutableSection ;
4239import org .elasticsearch .xcontent .NamedXContentRegistry ;
4340import org .elasticsearch .xcontent .ParseField ;
44- import org .elasticsearch .xcontent .ToXContent ;
45- import org .elasticsearch .xcontent .XContentBuilder ;
4641import org .junit .AfterClass ;
4742import org .junit .Before ;
48- import org .junit .BeforeClass ;
4943
5044import java .io .IOException ;
5145import java .nio .file .Files ;
6761import java .util .stream .Collectors ;
6862import java .util .stream .Stream ;
6963
70- import static org .elasticsearch .xcontent .XContentFactory .jsonBuilder ;
71-
7264/**
7365 * Runs a suite of yaml tests shared with all the official Elasticsearch
7466 * clients against an elasticsearch cluster.
@@ -125,15 +117,6 @@ protected ESClientYamlSuiteTestCase(ClientYamlTestCandidate testCandidate) {
125117 this .testCandidate = testCandidate ;
126118 }
127119
128- private static Settings globalTemplateIndexSettings ;
129-
130- @ BeforeClass
131- public static void initializeGlobalTemplateIndexSettings () {
132- globalTemplateIndexSettings = usually ()
133- ? Settings .EMPTY
134- : Settings .builder ().put (IndexMetadata .SETTING_NUMBER_OF_SHARDS , 2 ).build ();
135- }
136-
137120 @ Before
138121 public void initAndResetContext () throws Exception {
139122 if (restTestExecutionContext == null ) {
@@ -511,34 +494,6 @@ public void test() throws IOException {
511494 inFipsJvm () && testCandidate .getTestSection ().getPrerequisiteSection ().hasYamlRunnerFeature ("fips_140" )
512495 );
513496
514- final Settings globalTemplateSettings = getGlobalTemplateSettings (
515- testCandidate .getTestSection ().getPrerequisiteSection ().hasYamlRunnerFeature ("default_shards" )
516- );
517- if (globalTemplateSettings .isEmpty () == false && ESRestTestCase .has (ProductFeature .LEGACY_TEMPLATES )) {
518-
519- final XContentBuilder template = jsonBuilder ();
520- template .startObject ();
521- {
522- template .array ("index_patterns" , "*" );
523- template .startObject ("settings" );
524- globalTemplateSettings .toXContent (template , ToXContent .EMPTY_PARAMS );
525- template .endObject ();
526- }
527- template .endObject ();
528-
529- final Request request = new Request ("PUT" , "/_template/global" );
530- request .setJsonEntity (Strings .toString (template ));
531- // Because not all case have transitioned to a composable template, it's possible that
532- // this can overlap an installed composable template since this is a global (*)
533- // template. In order to avoid this failing the test, we override the warnings handler
534- // to be permissive in this case. This can be removed once all tests use composable
535- // templates instead of legacy templates
536- RequestOptions .Builder builder = RequestOptions .DEFAULT .toBuilder ();
537- builder .setWarningsHandler (WarningsHandler .PERMISSIVE );
538- request .setOptions (builder .build ());
539- adminClient ().performRequest (request );
540- }
541-
542497 if (skipSetupSections () == false && testCandidate .getSetupSection ().isEmpty () == false ) {
543498 logger .debug ("start setup test [{}]" , testCandidate .getTestPath ());
544499 for (ExecutableSection executableSection : testCandidate .getSetupSection ().getExecutableSections ()) {
@@ -564,19 +519,13 @@ public void test() throws IOException {
564519
565520 @ Deprecated
566521 protected Settings getGlobalTemplateSettings (List <String > features ) {
567- if (features .contains ("default_shards" )) {
568- return Settings .EMPTY ;
569- } else {
570- return globalTemplateIndexSettings ;
571- }
522+ // This method will be deleted once its uses in serverless are deleted
523+ return Settings .EMPTY ;
572524 }
573525
574526 protected Settings getGlobalTemplateSettings (boolean defaultShardsFeature ) {
575- if (defaultShardsFeature ) {
576- return Settings .EMPTY ;
577- } else {
578- return globalTemplateIndexSettings ;
579- }
527+ // This method will be deleted once its uses in serverless are deleted
528+ return Settings .EMPTY ;
580529 }
581530
582531 protected boolean skipSetupSections () {
0 commit comments