use of org.neo4j.cluster.VerifyInstanceConfiguration in project neo4j by neo4j.
the class InstanceIdTest method nodeTriesToJoinRunningClusterWithExistingServerId.
@Test
public void nodeTriesToJoinRunningClusterWithExistingServerId() throws InterruptedException, ExecutionException, TimeoutException, URISyntaxException {
List<URI> correctMembers = new ArrayList<>();
correctMembers.add(URI.create("server1"));
correctMembers.add(URI.create("server2"));
correctMembers.add(URI.create("server3"));
Map<String, InstanceId> roles = new HashMap<>();
roles.put("coordinator", new InstanceId(1));
testCluster(new int[] { 1, 2, 3, 3 }, new VerifyInstanceConfiguration[] { new VerifyInstanceConfiguration(correctMembers, roles, Collections.emptySet()), new VerifyInstanceConfiguration(correctMembers, roles, Collections.emptySet()), new VerifyInstanceConfiguration(correctMembers, roles, Collections.emptySet()), new VerifyInstanceConfiguration(Collections.emptyList(), Collections.emptyMap(), Collections.emptySet()) }, DEFAULT_NETWORK(), new ClusterTestScriptDSL().rounds(600).join(100, 1, 1).join(100, 2, 1).join(100, 3, 1).join(5000, 4, 1).message(0, "*** Conflicting node tried to join"));
}
use of org.neo4j.cluster.VerifyInstanceConfiguration in project neo4j by neo4j.
the class InstanceIdTest method substituteFailedNode.
@Test
public void substituteFailedNode() throws InterruptedException, ExecutionException, TimeoutException, URISyntaxException {
List<URI> correctMembers = new ArrayList<>();
correctMembers.add(URI.create("server1"));
correctMembers.add(URI.create("server2"));
correctMembers.add(URI.create("server4"));
List<URI> wrongMembers = new ArrayList<>();
wrongMembers.add(URI.create("server1"));
wrongMembers.add(URI.create("server2"));
wrongMembers.add(URI.create("server3"));
Map<String, InstanceId> roles = new HashMap<>();
roles.put("coordinator", new InstanceId(1));
Set<InstanceId> clusterMemberFailed = new HashSet<>();
Set<InstanceId> isolatedMemberFailed = new HashSet<>();
// will never receive heartbeats again from 1,2 so they are failed
isolatedMemberFailed.add(new InstanceId(1));
isolatedMemberFailed.add(new InstanceId(2));
testCluster(new int[] { 1, 2, 3, 3 }, new VerifyInstanceConfiguration[] { new VerifyInstanceConfiguration(correctMembers, roles, clusterMemberFailed), new VerifyInstanceConfiguration(correctMembers, roles, clusterMemberFailed), new VerifyInstanceConfiguration(wrongMembers, roles, isolatedMemberFailed), new VerifyInstanceConfiguration(correctMembers, roles, clusterMemberFailed) }, DEFAULT_NETWORK(), new ClusterTestScriptDSL().rounds(8000).join(100, 1, 1).join(100, 2, 1).join(100, 3, 1).down(3000, 3).join(1000, 4, 1, 2, 3));
}
use of org.neo4j.cluster.VerifyInstanceConfiguration in project neo4j by neo4j.
the class InstanceIdTest method substituteFailedNodeAndFailedComesOnlineAgain.
@Test
public void substituteFailedNodeAndFailedComesOnlineAgain() throws InterruptedException, ExecutionException, TimeoutException, URISyntaxException {
List<URI> correctMembers = new ArrayList<>();
correctMembers.add(URI.create("server1"));
correctMembers.add(URI.create("server2"));
correctMembers.add(URI.create("server4"));
List<URI> badMembers = new ArrayList<>();
badMembers.add(URI.create("server1"));
badMembers.add(URI.create("server2"));
badMembers.add(URI.create("server3"));
Map<String, InstanceId> roles = new HashMap<>();
roles.put("coordinator", new InstanceId(1));
// no failures
Set<InstanceId> clusterMemberFailed = new HashSet<>();
Set<InstanceId> isolatedMemberFailed = new HashSet<>();
// will never receive heartbeats again from 1,2 so they are failed
isolatedMemberFailed.add(new InstanceId(1));
isolatedMemberFailed.add(new InstanceId(2));
testCluster(new int[] { 1, 2, 3, 3 }, new VerifyInstanceConfiguration[] { new VerifyInstanceConfiguration(correctMembers, roles, clusterMemberFailed), new VerifyInstanceConfiguration(correctMembers, roles, clusterMemberFailed), new VerifyInstanceConfiguration(badMembers, roles, isolatedMemberFailed), new VerifyInstanceConfiguration(correctMembers, roles, clusterMemberFailed) }, DEFAULT_NETWORK(), new ClusterTestScriptDSL().rounds(800).join(100, 1, 1).join(100, 2, 1).join(100, 3, 1).down(3000, 3).join(1000, 4, 1, 2, 3).up(1000, 3));
}
Aggregations