use of com.netflix.titus.api.clustermembership.model.event.ClusterMembershipChangeEvent 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.ClusterMembershipChangeEvent in project titus-control-plane by Netflix.
the class KubeClusterMembershipConnectorTest method testRegistrationConnectionErrorRecoveryInReconciler.
@Test
public void testRegistrationConnectionErrorRecoveryInReconciler() throws InterruptedException {
doRegister();
kubeExecutors.failOnMembershipUpdate(new RuntimeException("Simulated membership update error"), 1);
await().until(() -> !kubeExecutors.isFailingOnMembershipUpdate());
long now = System.currentTimeMillis();
ClusterMembershipChangeEvent event;
while ((event = (ClusterMembershipChangeEvent) connectorEvents.takeNext(TIMEOUT)) != null) {
if (event.getRevision().getTimestamp() > now) {
return;
}
}
fail("No re-registration observed in time");
}
use of com.netflix.titus.api.clustermembership.model.event.ClusterMembershipChangeEvent 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.ClusterMembershipChangeEvent in project titus-control-plane by Netflix.
the class DefaultClusterMembershipServiceTest method expectLocalLeadershipTransition.
private void expectLocalLeadershipTransition(ClusterMemberLeadershipState state, boolean active) throws InterruptedException {
expectLocalLeadershipTransition(state);
ClusterMembershipChangeEvent membershipChangeEvent = (ClusterMembershipChangeEvent) eventSubscriber.takeNext(TIMEOUT);
assertThat(membershipChangeEvent).isNotNull();
assertThat(membershipChangeEvent.getRevision().getCurrent().isActive()).isEqualTo(active);
}
use of com.netflix.titus.api.clustermembership.model.event.ClusterMembershipChangeEvent 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;
}
}
}
}
Aggregations