[TEST] ensure feature registration on same node

Original commit: elastic/x-pack-elasticsearch@434f3dff8e
This commit is contained in:
Areek Zillur 2015-01-25 14:32:37 -05:00
parent 0325d169e9
commit 72c614373a
2 changed files with 9 additions and 9 deletions
plugin/src/test/java/org/elasticsearch/license/plugin

@ -179,12 +179,13 @@ public abstract class AbstractLicensesServiceTests extends AbstractLicensesInteg
} }
protected LicensesClientService licensesClientService() { protected LicensesClientService licensesClientService() {
return internalCluster().getInstance(LicensesClientService.class, node); final InternalTestCluster clients = internalCluster();
return internalCluster().getInstance(LicensesClientService.class, clients.getMasterName());
} }
protected LicensesService randomLicensesService() { protected LicensesService licensesService() {
String randomNode = randomFrom(nodes); final InternalTestCluster clients = internalCluster();
return internalCluster().getInstance(LicensesService.class, randomNode); return internalCluster().getInstance(LicensesService.class, clients.getMasterName());
} }
protected static ClusterService masterClusterService() { protected static ClusterService masterClusterService() {

@ -12,7 +12,6 @@ import org.elasticsearch.license.plugin.core.LicensesClientService;
import org.elasticsearch.license.plugin.core.LicensesManagerService; import org.elasticsearch.license.plugin.core.LicensesManagerService;
import org.elasticsearch.license.plugin.core.LicensesService; import org.elasticsearch.license.plugin.core.LicensesService;
import org.elasticsearch.license.plugin.core.LicensesStatus; import org.elasticsearch.license.plugin.core.LicensesStatus;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.util.*; import java.util.*;
@ -232,7 +231,7 @@ public class LicensesClientServiceTests extends AbstractLicensesServiceTests {
// multiple client registration with null trial license and then different expiry signed license // multiple client registration with null trial license and then different expiry signed license
final LicensesManagerService masterLicensesManagerService = masterLicensesManagerService(); final LicensesManagerService masterLicensesManagerService = masterLicensesManagerService();
final LicensesService licensesService = randomLicensesService(); final LicensesService licensesService = licensesService();
String feature1 = "feature1"; String feature1 = "feature1";
String feature2 = "feature2"; String feature2 = "feature2";
final TestTrackingClientListener clientListener1 = new TestTrackingClientListener(feature1); final TestTrackingClientListener clientListener1 = new TestTrackingClientListener(feature1);
@ -264,7 +263,7 @@ public class LicensesClientServiceTests extends AbstractLicensesServiceTests {
// multiple client registration: one with trial license and another with signed license (different expiry duration) // multiple client registration: one with trial license and another with signed license (different expiry duration)
final LicensesManagerService masterLicensesManagerService = masterLicensesManagerService(); final LicensesManagerService masterLicensesManagerService = masterLicensesManagerService();
final LicensesService licensesService = randomLicensesService(); final LicensesService licensesService = licensesService();
String feature1 = "feature1"; String feature1 = "feature1";
String feature2 = "feature2"; String feature2 = "feature2";
final TestTrackingClientListener clientListener1 = new TestTrackingClientListener(feature1); final TestTrackingClientListener clientListener1 = new TestTrackingClientListener(feature1);
@ -294,7 +293,7 @@ public class LicensesClientServiceTests extends AbstractLicensesServiceTests {
public void testMultipleClientTrialLicenseRegistration() throws Exception { public void testMultipleClientTrialLicenseRegistration() throws Exception {
// multiple client registration: both with trail license of different expiryDuration // multiple client registration: both with trail license of different expiryDuration
final LicensesService licensesService = randomLicensesService(); final LicensesService licensesService = licensesService();
String feature1 = "feature1"; String feature1 = "feature1";
String feature2 = "feature2"; String feature2 = "feature2";
final TestTrackingClientListener clientListener1 = new TestTrackingClientListener(feature1); final TestTrackingClientListener clientListener1 = new TestTrackingClientListener(feature1);
@ -347,7 +346,7 @@ public class LicensesClientServiceTests extends AbstractLicensesServiceTests {
@Test @Test
public void testRandomActionSequenceMultipleFeature() throws Exception { public void testRandomActionSequenceMultipleFeature() throws Exception {
LicensesService licensesService = randomLicensesService(); LicensesService licensesService = licensesService();
LicensesManagerService masterLicensesManagerService = masterLicensesManagerService(); LicensesManagerService masterLicensesManagerService = masterLicensesManagerService();
Map<TestTrackingClientListener, List<Action>> clientListenersWithActions = new HashMap<>(); Map<TestTrackingClientListener, List<Action>> clientListenersWithActions = new HashMap<>();