mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 01:19:02 +00:00
[TEST] assume assertions are enabled
This commit is contained in:
parent
af4b7ee000
commit
895a7dd03c
@ -74,7 +74,6 @@ public class PercolatorQueriesRegistry extends AbstractIndexShardComponent imple
|
||||
private final IndexQueryParserService queryParserService;
|
||||
private final MapperService mapperService;
|
||||
private final IndicesLifecycle indicesLifecycle;
|
||||
private final IndexCache indexCache;
|
||||
private final IndexFieldDataService indexFieldDataService;
|
||||
|
||||
private final ShardIndexingService indexingService;
|
||||
@ -98,13 +97,12 @@ public class PercolatorQueriesRegistry extends AbstractIndexShardComponent imple
|
||||
@Inject
|
||||
public PercolatorQueriesRegistry(ShardId shardId, @IndexSettings Settings indexSettings, IndexQueryParserService queryParserService,
|
||||
ShardIndexingService indexingService, IndicesLifecycle indicesLifecycle, MapperService mapperService,
|
||||
IndexCache indexCache, IndexFieldDataService indexFieldDataService, ShardPercolateService shardPercolateService) {
|
||||
IndexFieldDataService indexFieldDataService, ShardPercolateService shardPercolateService) {
|
||||
super(shardId, indexSettings);
|
||||
this.queryParserService = queryParserService;
|
||||
this.mapperService = mapperService;
|
||||
this.indicesLifecycle = indicesLifecycle;
|
||||
this.indexingService = indexingService;
|
||||
this.indexCache = indexCache;
|
||||
this.indexFieldDataService = indexFieldDataService;
|
||||
this.shardPercolateService = shardPercolateService;
|
||||
this.mapUnmappedFieldsAsString = indexSettings.getAsBoolean(MAP_UNMAPPED_FIELDS_AS_STRING, false);
|
||||
|
@ -600,4 +600,13 @@ public abstract class ElasticsearchTestCase extends LuceneTestCase {
|
||||
return list.subList(0, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true iff assertions for elasticsearch packages are enabled
|
||||
*/
|
||||
public static boolean assertionsEnabled() {
|
||||
boolean enabled = false;
|
||||
assert (enabled = true);
|
||||
return enabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ public class IndexDeleteByQueryResponseTests extends ElasticsearchTestCase {
|
||||
|
||||
@Test
|
||||
public void testNegativeCounters() {
|
||||
assumeTrue("assertions must be enable for this test to pass", assertionsEnabled());
|
||||
try {
|
||||
new IndexDeleteByQueryResponse("index", -1L, 0L, 0L, 0L);
|
||||
fail("should have thrown an assertion error concerning the negative counter");
|
||||
@ -107,6 +108,7 @@ public class IndexDeleteByQueryResponseTests extends ElasticsearchTestCase {
|
||||
|
||||
@Test
|
||||
public void testNegativeIncrements() {
|
||||
assumeTrue("assertions must be enable for this test to pass", assertionsEnabled());
|
||||
try {
|
||||
IndexDeleteByQueryResponse response = new IndexDeleteByQueryResponse();
|
||||
response.incrementFound(-10L);
|
||||
@ -163,4 +165,5 @@ public class IndexDeleteByQueryResponseTests extends ElasticsearchTestCase {
|
||||
assertThat(deserializedResponse.getMissing(), equalTo(response.getMissing()));
|
||||
assertThat(deserializedResponse.getFailed(), equalTo(response.getFailed()));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user