How to use ESIntegTestCase to load plugins in elasticsearch 5.6.3?


(dung ta van) #1

here is my source code:

@ClusterScope(scope = Scope.SUITE)
public class MyExpertScriptEngineTest extends ESIntegTestCase {
	
	public MyExpertScriptEngineTest() {
		System.setProperty(TESTS_CLUSTER, "localhost:9300");
		System.setProperty("tests.rest.cluster", "localhost:9200");
	}
	
	@Override
    protected Collection<Class<? extends Plugin>> nodePlugins() {
        return Collections.singleton(ExamplePlugin.class);
    }
}

I see that, nodePlugins didn't fire.


(Alexander Reelsen) #2

Hey,

this looks good from a quick check, we do the same in our tests, except with the CTOR, that should be put into a before method or handed in via properties on the command line.

Keep in mind, that ES starts on other than the default ports. Showing the logs from the test might be very useful in a gist.

--Alex


(dung ta van) #3

Hi @spinscale,

Can you take a look my test case?

Here is stacktrace:

java.lang.IllegalArgumentException: no hosts provided
	at __randomizedtesting.SeedInfo.seed([FB7A456648DB37AC:E8E928B8F26BEDEF]:0)
	at org.elasticsearch.client.RestClientBuilder.<init>(RestClientBuilder.java:67)
	at org.elasticsearch.client.RestClient.builder(RestClient.java:117)
	at org.elasticsearch.test.ESIntegTestCase.createRestClient(ESIntegTestCase.java:2200)
	at org.elasticsearch.test.ESIntegTestCase.createRestClient(ESIntegTestCase.java:2184)
	at org.elasticsearch.test.ESIntegTestCase.getRestClient(ESIntegTestCase.java:2178)
	at org.elasticsearch.plugin.example.testing.MyExpertScriptEngineTest.testSimulateProcessor(MyExpertScriptEngineTest.java:82)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1737)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:934)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:970)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:984)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:49)
	at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
	at org.apache.lucene.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:48)
	at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
	at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468)
	at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:943)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:829)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:879)
	at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:890)
	at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
	at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
	at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
	at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
	at java.lang.Thread.run(Thread.java:745)

(Alexander Reelsen) #4

the problem is not plugin loading, but the rest client initialization


(dung ta van) #5

So, what's exactly mean of:

@Override
	protected boolean ignoreExternalCluster() {
		return true;
	}
	
	@Override
	protected Collection<Class<? extends Plugin>> transportClientPlugins() {
		return Collections.singleton(ExamplePlugin.class);
	}
	
	@Override
    protected Collection<Class<? extends Plugin>> nodePlugins() {
        return Collections.singleton(ExamplePlugin.class);
    }

(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.