Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.
This repository was archived by the owner on May 14, 2026. It is now read-only.

HttpJsonTest fails for a singleton resource #1780

Description

@alexander-fenster

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.

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions