use of com.netflix.titus.api.clustermembership.model.event.LeaderElectionChangeEvent in project titus-control-plane by Netflix.
the class KubeClusterMembershipConnectorTest method takeLeaderElectionEvent.
private LeaderElectionChangeEvent takeLeaderElectionEvent(LeaderElectionChangeEvent.ChangeType changeType) throws InterruptedException {
ClusterMembershipEvent event = connectorEvents.takeNext(TIMEOUT);
assertThat(event).isInstanceOf(LeaderElectionChangeEvent.class);
LeaderElectionChangeEvent electionEvent = (LeaderElectionChangeEvent) event;
assertThat(electionEvent.getChangeType()).isEqualTo(changeType);
return electionEvent;
}
use of com.netflix.titus.api.clustermembership.model.event.LeaderElectionChangeEvent in project titus-control-plane by Netflix.
the class KubeClusterMembershipConnectorTest method joinLeaderElectionProcess.
private void joinLeaderElectionProcess() throws InterruptedException {
connector.joinLeadershipGroup().block();
LeaderElectionChangeEvent electionEvent = takeLeaderElectionEvent(LeaderElectionChangeEvent.ChangeType.LocalJoined);
assertThat(electionEvent.getLeadershipRevision().getCurrent().getLeadershipState()).isEqualTo(ClusterMemberLeadershipState.NonLeader);
assertThat(connector.getLocalLeadershipRevision().getCurrent().getLeadershipState()).isEqualTo(ClusterMemberLeadershipState.NonLeader);
}
use of com.netflix.titus.api.clustermembership.model.event.LeaderElectionChangeEvent in project titus-control-plane by Netflix.
the class KubeClusterMembershipConnectorTest method electLocalAsLeader.
private void electLocalAsLeader() throws InterruptedException {
kubeExecutors.emitLeadershipEvent(ClusterMembershipEvent.leaderElected(ClusterMembershipRevision.<ClusterMemberLeadership>newBuilder().withCurrent(ClusterMemberLeadership.newBuilder().withMemberId(LOCAL_MEMBER_UNREGISTERED.getMemberId()).withLeadershipState(ClusterMemberLeadershipState.Leader).build()).build()));
LeaderElectionChangeEvent electionEvent = takeLeaderElectionEvent(LeaderElectionChangeEvent.ChangeType.LeaderElected);
assertThat(electionEvent.getLeadershipRevision().getCurrent().getLeadershipState()).isEqualTo(ClusterMemberLeadershipState.Leader);
}
use of com.netflix.titus.api.clustermembership.model.event.LeaderElectionChangeEvent in project titus-control-plane by Netflix.
the class KubeClusterMembershipConnectorTest method leaveLeaderElectionProcess.
private void leaveLeaderElectionProcess() throws InterruptedException {
connector.leaveLeadershipGroup(true).block();
LeaderElectionChangeEvent electionEvent = takeLeaderElectionEvent(LeaderElectionChangeEvent.ChangeType.LocalLeft);
assertThat(electionEvent.getLeadershipRevision().getCurrent().getLeadershipState()).isEqualTo(ClusterMemberLeadershipState.Disabled);
assertThat(connector.getLocalLeadershipRevision().getCurrent().getLeadershipState()).isEqualTo(ClusterMemberLeadershipState.Disabled);
}
Aggregations