File tree Expand file tree Collapse file tree 4 files changed +13
-2
lines changed 
main/java/org/elasticsearch/test/rest/yaml 
test/java/org/elasticsearch/test/rest/yaml/section Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ public class ClientYamlTestClient implements Closeable {
8484        this .clientBuilderWithSniffedNodes  = clientBuilderWithSniffedNodes ;
8585    }
8686
87+     /** 
88+      * @return the version of the oldest node in the cluster 
89+      */ 
8790    public  Version  getEsVersion () {
8891        return  esVersion ;
8992    }
Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ public Stash stash() {
206206    }
207207
208208    /** 
209-      * Returns  the current es version as a string  
209+      * @return  the version of the oldest node in the cluster  
210210     */ 
211211    public  Version  esVersion () {
212212        return  clientYamlTestClient .getEsVersion ();
Original file line number Diff line number Diff line change @@ -367,7 +367,13 @@ public void execute(ClientYamlTestExecutionContext executionContext) throws IOEx
367367            final  String  testPath  = executionContext .getClientYamlTestCandidate () != null 
368368                ? executionContext .getClientYamlTestCandidate ().getTestPath ()
369369                : null ;
370-             checkElasticProductHeader (response .getHeaders ("X-elastic-product" ));
370+             if  (executionContext .esVersion ().after (Version .V_8_0_1 )
371+                 || (executionContext .esVersion ().major  == Version .V_7_17_0 .major  && executionContext .esVersion ().after (Version .V_7_17_1 ))) {
372+                 // #84038 and #84089 mean that this assertion fails when running against a small number of released versions, but at time of 
373+                 // writing it's unclear exactly which released versions will contain the fix. 
374+                 // TODO once a fixed version has been released, adjust the condition above to match. 
375+                 checkElasticProductHeader (response .getHeaders ("X-elastic-product" ));
376+             }
371377            checkWarningHeaders (response .getWarningHeaders (), testPath );
372378        } catch  (ClientYamlTestResponseException  e ) {
373379            ClientYamlTestResponse  restTestResponse  = e .getRestTestResponse ();
Original file line number Diff line number Diff line change 1414import  org .elasticsearch .client .NodeSelector ;
1515import  org .elasticsearch .common .ParsingException ;
1616import  org .elasticsearch .common .logging .HeaderWarning ;
17+ import  org .elasticsearch .test .VersionUtils ;
1718import  org .elasticsearch .test .rest .yaml .ClientYamlTestExecutionContext ;
1819import  org .elasticsearch .test .rest .yaml .ClientYamlTestResponse ;
1920import  org .elasticsearch .xcontent .XContentLocation ;
@@ -605,6 +606,7 @@ public void testNodeSelectorByVersion() throws IOException {
605606                doSection .getApiCallSection ().getNodeSelector ()
606607            )
607608        ).thenReturn (mockResponse );
609+         when (context .esVersion ()).thenReturn (VersionUtils .randomVersion (random ()));
608610        when (mockResponse .getHeaders ("X-elastic-product" )).thenReturn (List .of ("Elasticsearch" ));
609611        doSection .execute (context );
610612        verify (context ).callApi (
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments