File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed 
qa/packaging/src/test/java/org/elasticsearch/packaging/test Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -141,12 +141,21 @@ private String getEnrollmentToken() throws Exception {
141141                );
142142            }
143143
144-             final  String   tokenValue  = result .stdout ()
144+             final  List < String >  filteredResult  = result .stdout ()
145145                .lines ()
146146                .filter (line  -> line .startsWith ("WARNING:" ) == false )
147-                 .findFirst ()
148-                 .orElseThrow (() -> new  AssertionError ("Failed to find any non-warning output lines" ));
149-             enrollmentTokenHolder .set (tokenValue );
147+                 .filter (line  -> line .matches ("\\ d{2}:\\ d{2}:\\ d{2}\\ .\\ d{3} \\ [main\\ ].*" ) == false )
148+                 .toList ();
149+ 
150+             if  (filteredResult .size () > 1 ) {
151+                 throw  new  AssertionError (
152+                     "Result from elasticsearch-create-enrollment-token contains unexpected output. Output was: \n "  + result .stdout ()
153+                 );
154+             } else  if  (filteredResult .isEmpty ()) {
155+                 throw  new  AssertionError ("Failed to find any non-warning output lines. Output was: \n "  + result .stdout ());
156+             }
157+ 
158+             enrollmentTokenHolder .set (filteredResult .getFirst ());
150159        }, 30 , TimeUnit .SECONDS );
151160
152161        return  enrollmentTokenHolder .get ();
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments