use of io.fabric8.commons.DeleteEntity in project kubernetes-client by fabric8io.
the class ClusterRoleBindingIT method delete.
@Test
public void delete() {
ClusterRoleBindingList clusterRoleBindingListBefore = client.rbac().clusterRoleBindings().list();
boolean deleted = client.rbac().clusterRoleBindings().withName("read-nodes-delete").delete();
assertTrue(deleted);
DeleteEntity<ClusterRoleBinding> clusterRoleBindingDeleteEntity = new DeleteEntity<>(ClusterRoleBinding.class, client, "read-nodes", null);
await().atMost(30, TimeUnit.SECONDS).until(clusterRoleBindingDeleteEntity);
ClusterRoleBindingList clusterRoleBindingListAfter = client.rbac().clusterRoleBindings().list();
assertEquals(clusterRoleBindingListBefore.getItems().size() - 1, clusterRoleBindingListAfter.getItems().size());
}
use of io.fabric8.commons.DeleteEntity in project kubernetes-client by fabric8io.
the class DeleteIT method testDeleteResourceCascading.
@Test
public void testDeleteResourceCascading() {
// Given
String name = "deleteit-resource-cascading";
// When
ReplicaSet replicaSet = client.apps().replicaSets().inNamespace(session.getNamespace()).withName(name).get();
Boolean isDeleted = client.resource(replicaSet).inNamespace(session.getNamespace()).cascading(true).delete();
// Then
assertTrue(isDeleted);
DeleteEntity<ReplicaSet> deleteEntity = new DeleteEntity<>(ReplicaSet.class, client, name, session.getNamespace());
await().atMost(30, TimeUnit.SECONDS).until(deleteEntity);
}
use of io.fabric8.commons.DeleteEntity in project kubernetes-client by fabric8io.
the class RoleBindingIT method delete.
@Test
public void delete() {
int initialCountBeforeDeletion = client.rbac().roleBindings().inNamespace(session.getNamespace()).list().getItems().size();
boolean deleted = client.rbac().roleBindings().inNamespace(session.getNamespace()).withName("rb-delete").delete();
assertTrue(deleted);
DeleteEntity<RoleBinding> deleteEntity = new DeleteEntity<>(RoleBinding.class, client, "read-jobs", session.getNamespace());
await().atMost(60, TimeUnit.SECONDS).until(deleteEntity);
RoleBindingList roleBindingList = client.rbac().roleBindings().inNamespace(session.getNamespace()).list();
assertEquals(initialCountBeforeDeletion - 1, roleBindingList.getItems().size());
}
use of io.fabric8.commons.DeleteEntity in project kubernetes-client by fabric8io.
the class UserImpersonationIT method cleanup.
@After
public void cleanup() {
// Reset original authentication
RequestConfig requestConfig = client.getConfiguration().getRequestConfig();
requestConfig.setImpersonateUsername(null);
requestConfig.setImpersonateGroups((String) null);
// DeleteEntity Cluster Role
client.rbac().clusterRoles().delete(impersonatorRole);
await().atMost(30, TimeUnit.SECONDS).until(kubernetesClusterRoleIsDeleted());
// DeleteEntity Cluster Role binding
client.rbac().clusterRoleBindings().delete(impersonatorRoleBinding);
await().atMost(30, TimeUnit.SECONDS).until(kubernetesClusterRoleBindingIsDeleted());
// DeleteEntity project
client.projects().withName(NEW_PROJECT).delete();
await().atMost(30, TimeUnit.SECONDS).until(projectIsDeleted());
// DeleteEntity ServiceAccounts
client.serviceAccounts().inNamespace(currentNamespace).delete(serviceAccount1);
await().atMost(30, TimeUnit.SECONDS).until(serviceAccountIsDeleted());
}
Aggregations