googleapis / sdk-platform-java

Tooling and shared libraries for Cloud SDK for Java
https://cloud.google.com/java/docs/bom
Apache License 2.0
63 stars 50 forks source link

HttpJsonTest fails for a singleton resource #1780

Closed alexander-fenster closed 11 months ago

alexander-fenster commented 1 year ago

In the Billing v1 API, I disabled CloudBillingClientHttpJsonTest because it fails:

https://github.com/googleapis/googleapis/blob/f47256507d4d21026fd865582f375d1d0e010a06/google/cloud/billing/v1/BUILD.bazel#L93-L95

java_gapic_test(
    name = "billing_java_gapic_test_suite",
    test_classes = [
        # This test is temporarily disabled due to the issue:
        # https://github.com/googleapis/sdk-platform-java/issues/1780
        # "com.google.cloud.billing.v1.CloudBillingClientHttpJsonTest",
        ...
    ],
    ....
)

The failure is most likely caused by the fact that they now have a singleton resource:

https://github.com/googleapis/googleapis/blob/f47256507d4d21026fd865582f375d1d0e010a06/google/cloud/billing/v1/cloud_billing.proto#L241-L245

message ProjectBillingInfo {
  option (google.api.resource) = {
    type: "cloudbilling.googleapis.com/ProjectBillingInfo"
    pattern: "projects/{project}/billingInfo"
  };
  ...
}

For some reason, the generated HTTP URI for the singleton resource is wrong:

Executing tests from //google/cloud/billing/v1:com.google.cloud.billing.v1.CloudBillingClientHttpJsonTest
-----------------------------------------------------------------------------
JUnit4 Test Runner
..........E........................
Time: 0.723
There was 1 failure:
1) getProjectBillingInfoTest(com.google.cloud.billing.v1.CloudBillingClientHttpJsonTest)
com.google.api.gax.rpc.NotFoundException: com.google.api.client.http.HttpResponseException: 404
GET https://cloudbilling.googleapis.com:443/v1/projects/%5BPROJECT_ID%5D/billingInfo/billingInfo?$alt=json;enum-encoding%3Dint
Method not found for path 'https:///v1/projects/%5BPROJECT_ID%5D/billingInfo/billingInfo'

Note the duplicated billingInfo/billingInfo in the URL.

lqiu96 commented 11 months ago

This should be resolved once b/295022244 is auto published. ETA for CL being submitted is approximately 8/22 and resolution will come in through a PR for cloud billing.

suztomo commented 11 months ago

b/295022244 points to cl/562820286, which was just submitted.