Skip to content

Commit

Permalink
update test to probe hpa deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
ukclivecox committed Apr 10, 2019
1 parent fb0096c commit a4a8755
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import org.junit.Test;

Expand All @@ -23,6 +24,7 @@
import io.kubernetes.client.models.ExtensionsV1beta1DeploymentList;
import io.kubernetes.client.models.V1ObjectMeta;
import io.kubernetes.client.proto.Meta.DeleteOptions;
import io.kubernetes.client.proto.V2beta1Autoscaling.HorizontalPodAutoscaler;
import io.seldon.clustermanager.AppTest;
import io.seldon.clustermanager.ClusterManagerProperites;
import io.seldon.clustermanager.k8s.SeldonDeploymentOperatorImpl.DeploymentResources;
Expand Down Expand Up @@ -101,12 +103,16 @@ public void testDeploymentsNoDelete() throws IOException, ApiException, SeldonDe
when(client.getApiClient()).thenReturn(apiClient);
when(client.delete(any(Message.Builder.class), any(String.class), any(DeleteOptions.class))).thenReturn(new ObjectOrStatus<>(mlDep,null));

when(crdHandler.getOwnedHPAs(any(String.class), any(String.class))).thenReturn(Optional.empty());

SeldonDeletionHandler delHandler = new SeldonDeletionHandler(crdHandler);

delHandler.removeDeployments(client, namespace, mlDep, resources.deployments, false);
verify(client, never()).delete(any(Message.Builder.class), any(String.class), any(DeleteOptions.class));

List<HorizontalPodAutoscaler> hpas = new ArrayList<>();
delHandler.removeHPAs(apiClient, namespace, mlDep, hpas);

}

}

0 comments on commit a4a8755

Please sign in to comment.