File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
server/src/internalClusterTest/java/org/opensearch/search/profile/aggregation Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1039,17 +1039,21 @@ public void testTopHitsAggregationFetchProfiling() throws Exception {
10391039 if ("fetch" .equals (result .getQueryName ())) {
10401040 mainFetchCount ++;
10411041 } else if (result .getQueryName ().contains ("top_hits_agg1" )) {
1042- topHitsFetch1 = result ;
1042+ if (topHitsFetch1 == null ) {
1043+ topHitsFetch1 = result ; // Keep first instance for validation
1044+ }
10431045 topHitsAgg1Count ++;
10441046 } else if (result .getQueryName ().contains ("top_hits_agg2" )) {
1045- topHitsFetch2 = result ;
1047+ if (topHitsFetch2 == null ) {
1048+ topHitsFetch2 = result ; // Keep first instance for validation
1049+ }
10461050 topHitsAgg2Count ++;
10471051 }
10481052 }
10491053
1050- // Verify we have the expected top_hits aggregations (the main requirement )
1051- assertEquals ("Should have exactly 1 top_hits_agg1 fetch operation" , 1 , topHitsAgg1Count );
1052- assertEquals ("Should have exactly 1 top_hits_agg2 fetch operation" , 1 , topHitsAgg2Count );
1054+ // Verify we have the expected aggregations (concurrent search may create multiple instances )
1055+ assertTrue ("Should have at least 1 top_hits_agg1 fetch operation" , topHitsAgg1Count >= 1 );
1056+ assertTrue ("Should have at least 1 top_hits_agg2 fetch operation" , topHitsAgg2Count >= 1 );
10531057 assertTrue ("Should have at least one main fetch operation" , mainFetchCount >= 1 );
10541058 assertTrue ("Should have at least 3 total fetch operations" , fetchProfileResults .size () >= 3 );
10551059
You can’t perform that action at this time.
0 commit comments