We are using ElasticSearch 5.6.9 on windows and we have a test framework which uses a customized runner for specific purpose (for performance benchmarking of certain scenarios like indexing/search).
When we try to start the ES from our test framework via ElasticSearch java api new Node().start().it fails with below exceptions which suggests to add carrot search Randomized runner.
But , we cannot get rid of the customized runner that we are using now.. Is there a way to avoid these errors without having the need to using Randomized runner?
I dont understand why the user written tests are forced to use Randomized runner...
org.elasticsearch.common.inject.CreationException: Guice creation errors:
-
Error injecting constructor, java.lang.IllegalStateException: running tests but failed to invoke RandomizedContext#getRandom
at org.elasticsearch.action.bulk.CustomTransportBulkAction.(Unknown Source)
while locating org.elasticsearch.action.bulk.CustomTransportBulkAction
Caused by: java.lang.IllegalStateException: running tests but failed to invoke RandomizedContext#getRandom
at org.elasticsearch.common.Randomness.get(Randomness.java:105)
at org.elasticsearch.action.ingest.IngestActionForwarder.(IngestActionForwarder.java:42)
at org.elasticsearch.action.bulk.CustomTransportBulkAction.(CustomTransportBulkAction.java:122)
at org.elasticsearch.action.bulk.CustomTransportBulkAction.(CustomTransportBulkAction.java:101)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:49)
at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)
at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:116)
at org.elasticsearch.common.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:47)
at org.elasticsearch.common.inject.InjectorImpl.callInContext(InjectorImpl.java:825)
at org.elasticsearch.common.inject.InjectorBuilder.build(InjectorBuilder.java:96)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:96)
at org.elasticsearch.common.inject.Guice.createInjector(Guice.java:70)
at org.elasticsearch.common.inject.ModulesBuilder.createInjector(ModulesBuilder.java:42)
at org.elasticsearch.node.Node.(Node.java:499)
at com.pega.platform.search.internal.ESSearchProviderEmbedded$ESNode.(ESSearchProviderEmbedded.java:234)
at com.pega.pegarules.performance.UnitPerformanceRunner.run(UnitPerformanceRunner.java:277)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.elasticsearch.common.Randomness.get(Randomness.java:101)
... 70 more
Caused by: java.lang.IllegalStateException: No context information for thread: Thread[id=1, name=L34990WIN, state=RUNNABLE, group=main]. Is this thread running under a class com.carrotsearch.randomizedtesting.RandomizedRunner runner context? Add @RunWith(class com.carrotsearch.randomizedtesting.RandomizedRunner.class) to your test class. Make sure your code accesses random contexts within @BeforeClass and @AfterClass boundary (for example, static test class initializers are not permitted to access random contexts).
at com.carrotsearch.randomizedtesting.RandomizedContext.context(RandomizedContext.java:207)
at com.carrotsearch.randomizedtesting.RandomizedContext.current(RandomizedContext.java:145)
... 75 more -
Error injecting constructor, java.lang.IllegalArgumentException: transport handlers for action indices:data/write/custom-bulk is already registered
at org.elasticsearch.action.bulk.CustomTransportBulkAction.(Unknown Source)
while locating org.elasticsearch.action.bulk.CustomTransportBulkAction
while locating org.elasticsearch.action.support.TransportAction annotated with @org.elasticsearch.common.inject.multibindings.Element(setName=,uniqueId=67)
Caused by: java.lang.IllegalArgumentException: transport handlers for action indices:data/write/custom-bulk is already registered
at org.elasticsearch.transport.TransportService.registerRequestHandler(TransportService.java:743)
at org.elasticsearch.transport.TransportService.registerRequestHandler(TransportService.java:737)
at org.elasticsearch.action.support.HandledTransportAction.(HandledTransportAction.java:50)
at org.elasticsearch.action.support.HandledTransportAction.(HandledTransportAction.java:43)
at org.elasticsearch.action.bulk.CustomTransportBulkAction.(CustomTransportBulkAction.java:113)
at org.elasticsearch.action.bulk.CustomTransportBulkAction.(CustomTransportBulkAction.java:101)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.elasticsearch.common.inject.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:49)
at org.elasticsearch.common.inject.ConstructorInjector.construct(ConstructorInjector.java:86)
at org.elasticsearch.common.inject.ConstructorBindingImpl$Factory.get(Con...