@Test public void isContainerRegionGroupAboveDesiredCapacity () { final String INSTANCE_GROUP = "12345"; final String PROJECT = "54321"; final String ZONE = "my-datacenter"; GcpComputeInstanceContainer container = GcpComputeInstanceContainer.builder() .withCreatedBy( ProjectRegionInstanceGroupManagerName .of(INSTANCE_GROUP, PROJECT, ZONE) .toString() .substring( ProjectRegionInstanceGroupName.SERVICE_ADDRESS .length() - "projects/" .length())) .build(); InstanceGroup instanceGroup = InstanceGroup.newBuilder().setSize(11).build(); InstanceGroupManager instanceGroupManager = InstanceGroupManager.newBuilder().setTargetSize(10).build(); doReturn(instanceGroup).when(regionInstanceGroupClient) .getRegionInstanceGroup(ProjectRegionInstanceGroupName.of(INSTANCE_GROUP, PROJECT, ZONE)); doReturn(instanceGroupManager).when(regionInstanceGroupManagerClient) .getRegionInstanceGroupManager(ProjectRegionInstanceGroupManagerName.of( INSTANCE_GROUP, PROJECT, ZONE)); assertTrue(gcpComputePlatform.isContainerGroupAtCapacity(container)); }
public boolean isContainerGroupAtCapacity (GcpComputeInstanceContainer container) { log.debug("Checking group actual size vs desired size for {}", v(DATADOG_CONTAINER_KEY, container)); String group = getContainerGroup(container); if (ProjectZoneInstanceGroupManagerName.isParsableFrom(group)) { return isContainerZoneGroupAtDesiredCapacity(container); } else if (ProjectRegionInstanceGroupManagerName.isParsableFrom(group)) { return isContainerRegionGroupAtDesiredCapacity(container); } log.debug("Could not find either a zone or regional group for {}", group); return false; }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public boolean isContainerGroupAtCapacity (GcpComputeInstanceContainer container) { log.debug("Checking group actual size vs desired size for {}", v(DATADOG_CONTAINER_KEY, container)); String group = getContainerGroup(container); if (ProjectZoneInstanceGroupManagerName.isParsableFrom(group)) { return isContainerZoneGroupAtDesiredCapacity(container); } else if (ProjectRegionInstanceGroupManagerName.isParsableFrom(group)) { return isContainerRegionGroupAtDesiredCapacity(container); } log.debug("Could not find either a zone or regional group for {}", group); return false; } }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public boolean isContainerGroupAtCapacity (GcpComputeInstanceContainer container) { log.debug("Checking group actual size vs desired size for {}", v(DATADOG_CONTAINER_KEY, container)); String group = getContainerGroup(container); if (ProjectZoneInstanceGroupManagerName.isParsableFrom(group)) { return isContainerZoneGroupAtDesiredCapacity(container); } else if (ProjectRegionInstanceGroupManagerName.isParsableFrom(group)) { return isContainerRegionGroupAtDesiredCapacity(container); } log.debug("Could not find either a zone or regional group for {}", group); return false; }  }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public boolean isContainerGroupAtCapacity (GcpComputeInstanceContainer container) { log.debug("Checking group actual size vs desired size for {}", v(DATADOG_CONTAINER_KEY, container)); String group = getContainerGroup(container); if (ProjectZoneInstanceGroupManagerName.isParsableFrom(group)) { return isContainerZoneGroupAtDesiredCapacity(container); } else if (ProjectRegionInstanceGroupManagerName.isParsableFrom(group)) { return isContainerRegionGroupAtDesiredCapacity(container); } log.debug("Could not find either a zone or regional group for {}", group); return false; }  void setRoutableCIDRBlocks(Collection<String> routableCIDRBlocks); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); Collection<Items> getIncludeFilter(); void setIncludeFilter(Map<String, String> includeFilter); Collection<Items> getExcludeFilter(); void setExcludeFilter(Map<String, String> excludeFilter); @Override boolean isContainerRecycled(Container container); String stopInstance(GcpComputeInstanceContainer container); ContainerHealth isContainerRunning(GcpComputeInstanceContainer gcpComputeInstanceContainer); String simulateMaintenance(GcpComputeInstanceContainer container); String setTags(GcpComputeInstanceContainer container, List<String> tags); String setTagsSafe(GcpComputeInstanceContainer container, List<String> newTags, String oldFingerprint); boolean isContainerGroupAtCapacity(GcpComputeInstanceContainer container); boolean checkTags(GcpComputeInstanceContainer container, List<String> expectedTags); void startInstance(GcpComputeInstanceContainer container); String restartContainer(GcpComputeInstanceContainer container); String getBestEndpoint(String privateIPAddress, String publicIPAddress); boolean isAddressRoutable(String privateIPAddress); String getLatestInstanceId(String instanceName, String zone); Fingerprint<List<String>> getFirewallTags(GcpComputeInstanceContainer container); void setProjectId(String projectId); @Override String getEndpoint(GcpComputeInstanceContainer container); @Override SSHCredentials getSshCredentials(GcpComputeInstanceContainer container); @Override String getRunningDirectory(); @Override void recycleContainer(GcpComputeInstanceContainer container); String recreateInstanceInInstanceGroup(GcpComputeInstanceContainer container); boolean isOperationComplete(String operationId); }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public boolean isContainerGroupAtCapacity (GcpComputeInstanceContainer container) { log.debug("Checking group actual size vs desired size for {}", v(DATADOG_CONTAINER_KEY, container)); String group = getContainerGroup(container); if (ProjectZoneInstanceGroupManagerName.isParsableFrom(group)) { return isContainerZoneGroupAtDesiredCapacity(container); } else if (ProjectRegionInstanceGroupManagerName.isParsableFrom(group)) { return isContainerRegionGroupAtDesiredCapacity(container); } log.debug("Could not find either a zone or regional group for {}", group); return false; }  void setRoutableCIDRBlocks(Collection<String> routableCIDRBlocks); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); Collection<Items> getIncludeFilter(); void setIncludeFilter(Map<String, String> includeFilter); Collection<Items> getExcludeFilter(); void setExcludeFilter(Map<String, String> excludeFilter); @Override boolean isContainerRecycled(Container container); String stopInstance(GcpComputeInstanceContainer container); ContainerHealth isContainerRunning(GcpComputeInstanceContainer gcpComputeInstanceContainer); String simulateMaintenance(GcpComputeInstanceContainer container); String setTags(GcpComputeInstanceContainer container, List<String> tags); String setTagsSafe(GcpComputeInstanceContainer container, List<String> newTags, String oldFingerprint); boolean isContainerGroupAtCapacity(GcpComputeInstanceContainer container); boolean checkTags(GcpComputeInstanceContainer container, List<String> expectedTags); void startInstance(GcpComputeInstanceContainer container); String restartContainer(GcpComputeInstanceContainer container); String getBestEndpoint(String privateIPAddress, String publicIPAddress); boolean isAddressRoutable(String privateIPAddress); String getLatestInstanceId(String instanceName, String zone); Fingerprint<List<String>> getFirewallTags(GcpComputeInstanceContainer container); void setProjectId(String projectId); @Override String getEndpoint(GcpComputeInstanceContainer container); @Override SSHCredentials getSshCredentials(GcpComputeInstanceContainer container); @Override String getRunningDirectory(); @Override void recycleContainer(GcpComputeInstanceContainer container); String recreateInstanceInInstanceGroup(GcpComputeInstanceContainer container); boolean isOperationComplete(String operationId);  }