use of com.netflix.titus.api.clustermembership.model.event.ClusterMembershipEvent in project titus-control-plane by Netflix.
the class KubeClusterMembershipConnectorTest method doAddOrUpdateSibling.
private ClusterMembershipRevision<ClusterMember> doAddOrUpdateSibling(ClusterMembershipRevision<ClusterMember> revision, ClusterMembershipChangeEvent.ChangeType changeType) throws InterruptedException {
String siblingId = revision.getCurrent().getMemberId();
kubeExecutors.addOrUpdateSibling(revision);
ClusterMembershipEvent event = connectorEvents.takeNext(TIMEOUT);
assertThat(event).isInstanceOf(ClusterMembershipChangeEvent.class);
assertThat(((ClusterMembershipChangeEvent) event).getChangeType()).isEqualTo(changeType);
assertThat(((ClusterMembershipChangeEvent) event).getRevision()).isEqualTo(revision);
assertThat(connector.getClusterMemberSiblings()).containsKey(siblingId);
return connector.getClusterMemberSiblings().get(siblingId);
}
use of com.netflix.titus.api.clustermembership.model.event.ClusterMembershipEvent in project titus-control-plane by Netflix.
the class KubeClusterMembershipConnectorTest method doRemoveSibling.
private void doRemoveSibling(ClusterMembershipRevision<ClusterMember> revision) throws InterruptedException {
kubeExecutors.removeSibling(revision.getCurrent().getMemberId());
ClusterMembershipEvent event = connectorEvents.takeNext(TIMEOUT);
assertThat(event).isInstanceOf(ClusterMembershipChangeEvent.class);
assertThat(((ClusterMembershipChangeEvent) event).getChangeType()).isEqualTo(ClusterMembershipChangeEvent.ChangeType.Removed);
}
use of com.netflix.titus.api.clustermembership.model.event.ClusterMembershipEvent in project titus-control-plane by Netflix.
the class AbstractKubeMembershipExecutorTest method findNextMemberEvent.
private ClusterMembershipChangeEvent findNextMemberEvent(String memberId) throws InterruptedException {
while (true) {
ClusterMembershipEvent event = eventSubscriber.takeNext(KUBE_TIMEOUT);
assertThat(event).isNotNull();
if (event instanceof ClusterMembershipChangeEvent) {
ClusterMembershipChangeEvent memberEvent = (ClusterMembershipChangeEvent) event;
if (memberEvent.getRevision().getCurrent().getMemberId().equals(memberId)) {
return memberEvent;
}
}
}
}
use of com.netflix.titus.api.clustermembership.model.event.ClusterMembershipEvent 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.ClusterMembershipEvent in project titus-control-plane by Netflix.
the class KubeClusterMembershipConnectorTest method doRegistrationChange.
private ClusterMembershipRevision<ClusterMember> doRegistrationChange(Supplier<ClusterMembershipRevision<ClusterMember>> action) throws InterruptedException {
long now = titusRuntime.getClock().wallTime();
ClusterMembershipRevision<ClusterMember> newRevision = action.get();
assertThat(newRevision.getTimestamp()).isGreaterThanOrEqualTo(now);
assertThat(connector.getLocalClusterMemberRevision()).isEqualTo(newRevision);
ClusterMembershipEvent registrationEvent1 = connectorEvents.takeNext(TIMEOUT);
assertThat(registrationEvent1).isInstanceOf(ClusterMembershipChangeEvent.class);
assertThat(((ClusterMembershipChangeEvent) registrationEvent1).getChangeType()).isEqualTo(ClusterMembershipChangeEvent.ChangeType.Updated);
return newRevision;
}
Aggregations