ESIntegTestCase nodePlugins issue when running from command line

I've got a fairly weird issue that I'm having trouble tracking down. I'm writing a plugin for a weighted average aggregation here. If I run the one integration test I have, WeightedAverageIT, via IntelliJ, the plugin I'm trying to test is loaded and the tests run without error. If I run the same tests from the commandline with gradle 2.13, the tests error out because none of the node plugins are loaded. I'm a bit baffled at how that could be. Any suggestions on where to start digging?

Below is the start of my test. I've also tried making all of the tests no ops and the same result occurred.

public class WeightedAverageIT extends AbstractNumericTestCase {

    @Override
    protected Collection<Class<? extends Plugin>> nodePlugins() {
        return Arrays.asList(
                WeightedAveragePlugin.class,
                ExtractFieldScriptPlugin.class,
                FieldValueScriptPlugin.class);
    }

Does it error out because it can't find the plugins? Is it maybe a
classpath thing?

If not, does your nodeplugins method get called? Like, I'd you add a log
line to it does it log? If not then that is weird.

It doesn't even try to load the plugins. I get errors like Caused by: java.lang.IllegalArgumentException: script_lang not supported [field_value] and Caused by: java.lang.IllegalArgumentException: Unknown NamedWriteable [org.elasticsearch.search.aggregations.InternalAggregation][weightedAverage].

I've put the log of the build output here. Adding a logline to nodePlugins() did not print the logline when running via commandline.

That one looks like it loaded your plugin:

  1> [2017-01-12T12:42:23,267][INFO ][o.e.p.PluginsService     ] [transport_client_external_0] loaded plugin [org.elasticsearch.plugin.weightedaverage.WeightedAveragePlugin]

Just not your test plugin.... I'm not sure what is up.

You should be able to connect to the test and debug it if you run gradle with --debug-jvm. That'll pause until you connect. I'd drop a breakpoint in buildTestCluster and then connect and play around.

Sorry I don't have any answers!

It loaded the plugin into the transport client, but not the node itself. I'll try debugging later today.

So I tried debugging, but the --debug-jvm option only debugs the ES nodes. I have fixed the issue with java.lang.IllegalArgumentException: Unknown NamedWriteable [org.elasticsearch.search.aggregations.InternalAggregation][weightedAverage] (I wasn't passing a name to addResultReader). However, it seems like the inner classes from my test ExtractFieldScriptPlugin and FieldValueScriptPlugin, which are modeled after the AvgIT test, are not being loaded when running from the command line.

After some digging I've found that the issue only exists when using the gradle plugin elasticsearch.esplugin. If I use the gradle plugin elasticsearch.build and explicitly define dependencies, then plugins defined in the nodePlugins() are loaded. I'm going to do a bit more digging to try and understand how the integTest task is different between the two gradle plugins.

1 Like

Well I figured it out. It's this bit of configuration

project.namingConventions {
    // Plugins declare integration tests as "Tests" instead of IT.
    skipIntegTestInDisguise = true
}

I just had to rename my test to end in Tests rather than IT.

I could've skipped over some configuration, but I'm not sure that fact is made clear in the current plugin author documentation. Since there are no aggregation plugins inside of the elasticsearch project I've been cribbing off of the core aggregation tests.

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