use of com.google.api.services.monitoring.v3.model.MonitoredResource in project kork by spinnaker.
the class MonitoredResourceBuilderTest method testGceInstance.
@Test
public void testGceInstance() throws IOException {
builder.setStackdriverProject("UNUSED");
String instance = "MY INSTANCE";
String zone = "us-central1-f";
String zone_path = "path/to/" + zone;
String project = "MY PROJECT";
doReturn(instance).when(builder).getGoogleMetadataValue("instance/id");
doReturn(zone_path).when(builder).getGoogleMetadataValue("instance/zone");
doReturn(project).when(builder).getGoogleMetadataValue("project/project-id");
Map<String, String> labels = new HashMap<String, String>();
labels.put("instance_id", instance);
labels.put("zone", zone);
MonitoredResource resource = builder.build();
Assert.assertEquals("gce_instance", resource.getType());
Assert.assertEquals(labels, resource.getLabels());
}
Aggregations