java-docs-samples
java-docs-samples copied to clipboard
compute/cloud-client/src/main/java/compute/CreateInstanceFromTemplate.java has no test and is broken
This snippet is never tested anywhere: compute/cloud-client/src/main/java/compute/CreateInstanceFromTemplate.java
When I tried to run it, I got:
{
"error": {
"code": 400,
"message": "Invalid value for field 'resource.disks[0].initializeParams.diskType': 'pd-balanced'. The URL is malformed.",
"errors": [
{
"message": "Invalid value for field 'resource.disks[0].initializeParams.diskType': 'pd-balanced'. The URL is malformed.",
"domain": "global",
"reason": "invalid"
}
]
}
}
Please update the sample with a test.
@Sita04 Would you be able to take a look at this? Let me know if I should redirect elsewhere. Thanks!
Please find the test for the particular snippet here: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/compute/cloud-client/src/test/java/compute/InstanceTemplatesIT.java#L104-L108
I'll further evaluate and get back why diskType throws an error.
@Sita04 hm, I was expecting to find this test in the test body decorated with @test. There are ways around re-creating the resource if the resource is not there / deleted, for example, in Pub/Sub, we ignore NotFound error during cleanup (https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/test/java/pubsub/AdminIT.java#L121) if a test deletes (https://github.com/googleapis/java-pubsub/blob/main/samples/snippets/src/test/java/pubsub/AdminIT.java#L278) a resource.