DefaultKubeMembershipExecutor implements KubeMembershipExecutor { @Override public Mono<Void> removeMember(String memberId) { return KubeClientReactorAdapters.doUpdate(callbackHandler -> kubeCustomObjectClient.deleteNamespacedCustomObjectAsync( KubeClusterMembershipModelConverters.CRD_GROUP, KubeClusterMembershipModelConverters.CRD_VERSION, namespace, KubeClusterMembershipModelConverters.CRD_PLURAL_MEMBERS, memberId, 0, false, null, new V1DeleteOptionsBuilder().build(), callbackHandler ) ).ignoreElement().cast(Void.class); } DefaultKubeMembershipExecutor(ApiClient kubeApiClient,
                                         String namespace); @Override Mono<ClusterMembershipRevision<ClusterMember>> getMemberById(String memberId); @Override Mono<ClusterMembershipRevision<ClusterMember>> createLocal(ClusterMembershipRevision<ClusterMember> localMemberRevision); @Override Mono<ClusterMembershipRevision<ClusterMember>> updateLocal(ClusterMembershipRevision<ClusterMember> localMemberRevision); @Override Mono<Void> removeMember(String memberId); @Override Flux<ClusterMembershipEvent> watchMembershipEvents();  }
@Test public void testRemoveMember() throws InterruptedException { ClusterMembershipRevision<ClusterMember> revision = newMemberRevision(); String memberId = revision.getCurrent().getMemberId(); ClusterMembershipRevision<ClusterMember> result = executor.createLocal(revision).block(); executor.removeMember(memberId).block(); try { executor.getMemberById(memberId).block(); fail("Found removed member"); } catch (Exception e) { assertThat(KubeUtils.is4xx(e)).isTrue(); } expectClusterMembershipChangeEvent(result, ClusterMembershipChangeEvent.ChangeType.Added); assertThat(findNextMemberEvent(memberId)).isNotNull(); }