Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{CI} Make recording responses' Content-Length match the body #20533

Closed
wants to merge 2 commits into from

Conversation

jiasli
Copy link
Member

@jiasli jiasli commented Nov 29, 2021

Symptom

When the test framework replaces a random name, its length is not preserved:

- appxxxxxxxxxxxx
+ app000003

This make Content-Length header in the response not match the actual body, causing failure due to the new azure-core check Azure/azure-sdk-for-python#20888.

https://dev.azure.com/azure-sdk/public/_build/results?buildId=1216795&view=logs&j=771f6cdf-8d98-5d9b-2fb9-d3a6e9554788&t=0a182f1d-9946-580d-467e-4d4ebd6af32d&l=15587

2021-11-29T04:30:29.8165866Z src/azure-cli/azure/cli/command_modules/appservice/commands.py:37: in _ex_handler
2021-11-29T04:30:29.8166504Z     raise ex
2021-11-29T04:30:29.8167402Z src/azure-cli-core/azure/cli/core/commands/__init__.py:692: in _run_job
2021-11-29T04:30:29.8168382Z     result = cmd_copy(params)
2021-11-29T04:30:29.8169244Z src/azure-cli-core/azure/cli/core/commands/__init__.py:328: in __call__
2021-11-29T04:30:29.8169905Z     return self.handler(*args, **kwargs)
2021-11-29T04:30:29.8170779Z src/azure-cli-core/azure/cli/core/commands/command_operation.py:121: in handler
2021-11-29T04:30:29.8171463Z     return op(**command_args)
2021-11-29T04:30:29.8172321Z src/azure-cli/azure/cli/command_modules/appservice/custom.py:240: in create_webapp
2021-11-29T04:30:29.8173461Z     _fill_ftp_publishing_url(cmd, webapp, resource_group_name, name)
2021-11-29T04:30:29.8174425Z src/azure-cli/azure/cli/command_modules/appservice/custom.py:1170: in _fill_ftp_publishing_url
2021-11-29T04:30:29.8175201Z     profiles = list_publish_profiles(cmd, resource_group_name, name, slot)
2021-11-29T04:30:29.8176163Z src/azure-cli/azure/cli/command_modules/appservice/custom.py:2089: in list_publish_profiles
2021-11-29T04:30:29.8176857Z     for f in content:
2021-11-29T04:30:29.8177521Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2021-11-29T04:30:29.8177910Z 
2021-11-29T04:30:29.8178442Z self = <azure.core.pipeline.transport._requests_basic.StreamDownloadGenerator object at 0x7fe8bc14b460>
2021-11-29T04:30:29.8178854Z 
2021-11-29T04:30:29.8179272Z     def __next__(self):
2021-11-29T04:30:29.8179805Z         internal_response = self.response.internal_response
2021-11-29T04:30:29.8180314Z         try:
2021-11-29T04:30:29.8180787Z             chunk = next(self.iter_content_func)
2021-11-29T04:30:29.8181287Z             if not chunk:
2021-11-29T04:30:29.8181750Z                 raise StopIteration()
2021-11-29T04:30:29.8182219Z             return chunk
2021-11-29T04:30:29.8182684Z         except StopIteration:
2021-11-29T04:30:29.8183171Z             internal_response.close()
2021-11-29T04:30:29.8183628Z             raise StopIteration()
2021-11-29T04:30:29.8184159Z         except requests.exceptions.StreamConsumedError:
2021-11-29T04:30:29.8184674Z             raise
2021-11-29T04:30:29.8185198Z         except requests.exceptions.ChunkedEncodingError as err:
2021-11-29T04:30:29.8185727Z             msg = err.__str__()
2021-11-29T04:30:29.8186456Z             if 'IncompleteRead' in msg:
2021-11-29T04:30:29.8187128Z                 _LOGGER.warning("Incomplete download: %s", err)
2021-11-29T04:30:29.8187708Z                 internal_response.close()
2021-11-29T04:30:29.8188399Z >               raise IncompleteReadError(err, error=err)
2021-11-29T04:30:29.8189756Z E               azure.core.exceptions.IncompleteReadError: ('Connection broken: IncompleteRead(1524 bytes read, 143 more expected)', IncompleteRead(1524 bytes read, 143 more expected))

Change

After this PR, the length is preserved:

- appxxxxxxxxxxxx
+ app000000000003

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 29, 2021

CI

@jiasli
Copy link
Member Author

jiasli commented Dec 9, 2021

Went down another path to fix Content-Length header instead (#20541).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants