added node tests

Original commit: elastic/x-pack-elasticsearch@c3957ea221
This commit is contained in:
Areek Zillur 2014-10-24 16:35:39 -04:00
parent e98336872c
commit 41e9d5db6d
1 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,57 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.license.plugin;
import org.elasticsearch.common.base.Predicate;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.node.internal.InternalNode;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.junit.Test;
import java.util.concurrent.TimeUnit;
import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.TEST;
import static org.hamcrest.Matchers.equalTo;
/**
*/
@ElasticsearchIntegrationTest.ClusterScope(scope = TEST, numDataNodes = 10)
public class LicensesServiceNodeTests extends ElasticsearchIntegrationTest {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return ImmutableSettings.settingsBuilder()
.put("plugins.load_classpath_plugins", false)
.putArray("plugin.types", LicensePlugin.class.getName(), TestConsumerPlugin.class.getName())
.put(InternalNode.HTTP_ENABLED, true)
.build();
}
@Override
protected Settings transportClientSettings() {
// Plugin should be loaded on the transport client as well
return nodeSettings(0);
}
@Test
public void testPluginStatus() throws Exception {
final Iterable<TestPluginService> testPluginServices = internalCluster().getDataNodeInstances(TestPluginService.class);
assertThat(awaitBusy(new Predicate<Object>() {
@Override
public boolean apply(Object o) {
for (TestPluginService pluginService : testPluginServices) {
if (!pluginService.enabled()) {
return false;
}
}
return true;
}
}, 10, TimeUnit.SECONDS), equalTo(true));
}
}