Skip to content

REST unit test test_update_settings_rest_flattened in logging_v2 fails #16395

@parthea

Description

@parthea

See the build log here which shows that the generated unit test test_update_settings_rest_flattened fails for logging_v2. The failure appears when we update the version of googleapis/googleapis in repositories.bzl

==================== Test output for //tests/integration:logging_py_gapic_test:
...
=================================== FAILURES ===================================
_____________________ test_update_settings_rest_flattened ______________________

    def test_update_settings_rest_flattened():
        client = ConfigServiceV2Client(
            credentials=ga_credentials.AnonymousCredentials(),
            transport="rest",
        )
    
        # Mock the http request call within the method and fake a response.
        with mock.patch.object(type(client.transport._session), 'request') as req:
            # Designate an appropriate value for the returned response.
            return_value = logging_config.Settings()
    
            # get arguments that satisfy an http rule for this method
            sample_request = {'name': 'sample1/sample2'}
    
            # get truthy value for each flattened field
            mock_args = dict(
                settings=logging_config.Settings(name='name_value'),
                update_mask=field_mask_pb2.FieldMask(paths=['paths_value']),
            )
            mock_args.update(sample_request)
    
            # Wrap the value into a proper Response obj
            response_value = Response()
            response_value.status_code = 200
            pb_return_value = logging_config.Settings.pb(return_value)
            json_return_value = json_format.MessageToJson(pb_return_value)
            response_value._content = json_return_value.encode('UTF-8')
            req.return_value = response_value
    
>           client.update_settings(**mock_args)
E           TypeError: ConfigServiceV2Client.update_settings() got an unexpected keyword argument 'name'

https://github.com/googleapis/gapic-generator-python/blob/42a8c82e87120e99d8e6df90d1f43c42f6ee2d73/repositories.bzl#L70-L75

See googleapis/gapic-generator-python#1725

The version of googleapis/googleapis in repositories.bzl should be updated periodically to a newer version to refresh the golden files.

As a workaround, we can disable REST generation for logging since it's not yet released.

Metadata

Metadata

Assignees

No one assigned

    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