use of io.fabric8.commons.DeleteEntity in project kubernetes-client by fabric8io.
the class ClusterRoleIT method delete.
@Test
public void delete() {
ClusterRoleList clusterRoleListBefore = client.rbac().clusterRoles().list();
boolean deleted = client.rbac().clusterRoles().withName("node-reader-delete").delete();
assertTrue(deleted);
DeleteEntity<ClusterRole> deleteEntity = new DeleteEntity<>(ClusterRole.class, client, "node-reader", null);
await().atMost(30, TimeUnit.SECONDS).until(deleteEntity);
ClusterRoleList clusterRoleListAfter = client.rbac().clusterRoles().list();
assertEquals(clusterRoleListBefore.getItems().size() - 1, clusterRoleListAfter.getItems().size());
}
use of io.fabric8.commons.DeleteEntity in project kubernetes-client by fabric8io.
the class DeleteIT method testDeleteResource.
@Test
public void testDeleteResource() {
// Given
String name = "deleteit-resource";
// When
ReplicaSet replicaSet = client.apps().replicaSets().inNamespace(session.getNamespace()).withName(name).get();
Boolean isDeleted = client.resource(replicaSet).inNamespace(session.getNamespace()).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 DeleteIT method testDeleteResourcePropagationPolicyBackground.
@Test
public void testDeleteResourcePropagationPolicyBackground() {
// Given
String name = "deleteit-resource-background";
// When
ReplicaSet replicaSet = client.apps().replicaSets().inNamespace(session.getNamespace()).withName(name).get();
Boolean isDeleted = client.resource(replicaSet).inNamespace(session.getNamespace()).withPropagationPolicy(DeletionPropagation.BACKGROUND).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 DeleteIT method testDeleteResourcePropagationPolicyForeground.
@Test
public void testDeleteResourcePropagationPolicyForeground() {
// Given
String name = "deleteit-resource-foreground";
// When
ReplicaSet replicaSet = client.apps().replicaSets().inNamespace(session.getNamespace()).withName(name).get();
Boolean isDeleted = client.resource(replicaSet).inNamespace(session.getNamespace()).withPropagationPolicy(DeletionPropagation.FOREGROUND).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 RoleIT method delete.
@Test
public void delete() {
int countBeforeDeletion = client.rbac().roles().inNamespace(currentNamespace).list().getItems().size();
boolean deleted = client.rbac().roles().inNamespace(currentNamespace).withName("role-delete").delete();
assertTrue(deleted);
DeleteEntity<Role> deleteEntity = new DeleteEntity<>(Role.class, client, "role-delete", currentNamespace);
await().atMost(30, TimeUnit.SECONDS).until(deleteEntity);
RoleList roleList = client.rbac().roles().inNamespace(currentNamespace).list();
assertEquals(countBeforeDeletion - 1, roleList.getItems().size());
}
Aggregations