Hi <@456226577798135808> & Team,
I need some help with the unit tests for this PR: cloudquery/cloudquery#14925.
I have added the test cases, and when I try to run them, I am getting the following error:
Oct 25 17:18:42.000000 INF top level table resolver started client=project:testProject table=gcp_networkconnectivity_locations
Oct 25 17:18:42.000000 ERR table resolver finished with error error="googleapi: got HTTP response code 404 with body: 404 page not found\n" client=project:testProject table=gcp_networkconnectivity_internal_ranges
Oct 25 17:18:42.000000 INF table sync finished client=project:testProject errors=0 resources=1 table=gcp_networkconnectivity_locations
Oct 25 17:18:42.000000 INF table sync finished client=project:testProject errors=1 resources=0 table=gcp_networkconnectivity_internal_ranges
testing_validation.go:15: found empty column(s): [project_id create_time description ip_cidr_range labels name network overlaps peering prefix_length target_cidr_range update_time usage users] in gcp_networkconnectivity_internal_ranges
Is there anything I might be missing in the test case that could lead to this issue?
Note: The parent table location
test is passing, but when I add the relation to the child table, I am noticing this error.
Hi @expert-lacewing! Check what data you actually get in the relation table (when casting parent item). Pointers & non-pointers, that sort of stuff.
Hi Alex,
I am getting all the internal ranges returned by the API as part of the relation table (internalRange
).
Example row values:
2023-10-25 05:20:29.952462,gcp,a6021faa-c2e6-5525-ad06-bf1f8618d02d,b08011ac-08de-5de8-9d90-b9281860cfb0,<projectID>,2023-10-18T16:21:37.369908648Z,FOR_VPC and NOT_SHARED,10.10.0.0/,"{""key"": ""val""}",projects/<projectID>/locations/global/internalRanges/test-lan-ir,https://www.googleapis.com/compute/v1/projects/<projectID>/global/networks/vpc-1,,NOT_SHARED,0,,2023-10-18T16:21:38.290258900Z,FOR_VPC
I feel the error googleapi: got HTTP response code 404 with body: 404 page not found
might be related to the path not matching in mock HTTP, but it seems I have given the correct path only.
You use location.Name
in the resolver, while in the mock test you return the location ID.
See how KMS handles mock:
https://github.com/cloudquery/cloudquery/blob/main/plugins/source/gcp/resources/services/kms/locations_mock_test.go#L23-L24
It worked after adding the location name in the mock. Many thanks for pointing it out. Please review it.
It got merged, thanks for the contribution!
The feature has been released as part of GCP v9.9.0
.