Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3k forks source link

Recording YAML shouldn't include `index.json` and `.whl` files #17435

Open jiasli opened 3 years ago

jiasli commented 3 years ago

Describe the bug

If an extension is installed by a command module in main repo, the recording .yaml file includes

https://github.com/Azure/azure-cli/blob/5b95a87f0294ee95feae1a43a14aa8e0656dea3a/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_event_grid.yaml#L58

    uri: https://azcliextensionsync.blob.core.windows.net/index1/index.json
  response:
    body:
      string: "{\n    \"extensions\": {\n        \"account\": [\n            {\n                \"downloadUrl\":
        \"https://azurecliprod.blob.core.windows.net/cli-extensions/account-0.1.0-py2.py3-none-any.whl\",\n
        \               \"filename\": \"account-0.1.0-py2.py3-none-any.whl\",\n                \"metadata\":
        {\n                    \"azext.isExperimental\": true,\n                    \"azext.minCliCoreVersion\":

https://github.com/Azure/azure-cli/blob/5b95a87f0294ee95feae1a43a14aa8e0656dea3a/src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_event_grid.yaml#L9287

    uri: https://azurecliprod.blob.core.windows.net/cli-extensions/eventgrid-0.4.9-py2.py3-none-any.whl
  response:
    body:
      string: !!binary |
        UEsDBBQAAAAIAA98slBejYsbowEAAKAEAAAbAAAAYXpleHRfZXZlbnRncmlkL19faW5pdF9fLnB5
        tVLBauMwEL3rKwZyqA2pP6DgQ3DLspC0sO1daOVxokWWhDQuSZb9953EjoudTWEPnYONpPee3hvN
        Au6/sMQCKh8O0Wx3BJnOYWN09Mk3xPsx+KjIeFfAylo4gxJETBjfsS6YuzYaXcIaOldjBNohbL6/
        XbYLeEUcF7QnMO6MCdH/Qk0QvSdofATbY/icV21/J8t/aXLRRN+COnYRC21NoX1kAy1nJlgdK9+2
        ytVp7RUnE2I4UEfck8R3dLSNpi7kDm0AWEA4WOPoAWqT1E+LZec67st9TxNCaKtSgqcT8RsTp/LZ

The sheer size makes GitHub unable to show and diff those files.

Affected files:

src/azure-cli/azure/cli/command_modules/monitor/tests/latest/recordings/test_monitor_autoscale_rule_for_spring_cloud.yaml
src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_event_grid_domain.yaml
src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_endpoint_connection_event_grid_topic.yaml
src/azure-cli/azure/cli/command_modules/network/tests/latest/recordings/test_private_link_resource_event_grid.yaml

Possible solutions

Either:

  1. Totally block the installation of extensions in main repo modules' tests, as this will cause CI instability (e.g. #17434). These tests should be at least marked as @live_only().

  2. Any request to https://azurecliprod.blob.core.windows.net/ should be patched and removed, like ResourceGroupPreparer.

yonzhan commented 3 years ago

Recording