@@ -631,40 +631,46 @@ private Response fetchMvLongs() throws IOException {
631
631
public void testLookupExplosion () throws IOException {
632
632
int sensorDataCount = 7500 ;
633
633
int lookupEntries = 10000 ;
634
- Map <?, ?> map = responseAsMap ( lookupExplosion (sensorDataCount , lookupEntries ) );
634
+ Map <?, ?> map = lookupExplosion (sensorDataCount , lookupEntries );
635
635
assertMap (map , matchesMap ().extraOk ().entry ("values" , List .of (List .of (sensorDataCount * lookupEntries ))));
636
636
}
637
637
638
638
public void testLookupExplosionManyMatches () throws IOException {
639
- assertCircuitBreaks (() -> lookupExplosion (8500 , 10000 ));
639
+ assertCircuitBreaks (() -> {
640
+ Map <?, ?> result = lookupExplosion (8500 , 10000 );
641
+ logger .error ("should have failed but got {}" , result );
642
+ });
640
643
}
641
644
642
- private Response lookupExplosion (int sensorDataCount , int lookupEntries ) throws IOException {
645
+ private Map <?, ?> lookupExplosion (int sensorDataCount , int lookupEntries ) throws IOException {
643
646
initSensorData (sensorDataCount , 1 );
644
647
initSensorLookup (lookupEntries , 1 , i -> "73.9857 40.7484" );
645
648
StringBuilder query = startQuery ();
646
649
query .append ("FROM sensor_data | LOOKUP JOIN sensor_lookup ON id | STATS COUNT(*)\" }" );
647
- return query (query .toString (), null );
650
+ return responseAsMap ( query (query .toString (), null ) );
648
651
}
649
652
650
653
public void testEnrichExplosion () throws IOException {
651
654
int sensorDataCount = 1000 ;
652
655
int lookupEntries = 100 ;
653
- Map <?, ?> map = responseAsMap ( enrichExplosion (sensorDataCount , lookupEntries ) );
656
+ Map <?, ?> map = enrichExplosion (sensorDataCount , lookupEntries );
654
657
assertMap (map , matchesMap ().extraOk ().entry ("values" , List .of (List .of (sensorDataCount ))));
655
658
}
656
659
657
660
public void testEnrichExplosionManyMatches () throws IOException {
658
- assertCircuitBreaks (() -> enrichExplosion (1000 , 10000 ));
661
+ assertCircuitBreaks (() -> {
662
+ Map <?, ?> result = enrichExplosion (3000 , 10000 );
663
+ logger .error ("should have failed but got {}" , result );
664
+ });
659
665
}
660
666
661
- private Response enrichExplosion (int sensorDataCount , int lookupEntries ) throws IOException {
667
+ private Map <?, ?> enrichExplosion (int sensorDataCount , int lookupEntries ) throws IOException {
662
668
initSensorData (sensorDataCount , 1 );
663
669
initSensorEnrich (lookupEntries , 1 , i -> "73.9857 40.7484" );
664
670
try {
665
671
StringBuilder query = startQuery ();
666
672
query .append ("FROM sensor_data | ENRICH sensor ON id | STATS COUNT(*)\" }" );
667
- return query (query .toString (), null );
673
+ return responseAsMap ( query (query .toString (), null ) );
668
674
} finally {
669
675
Request delete = new Request ("DELETE" , "/_enrich/policy/sensor" );
670
676
assertMap (responseAsMap (client ().performRequest (delete )), matchesMap ().entry ("acknowledged" , true ));
0 commit comments