Azure / azure-cli

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

az cli check resource group in all create (put) command breaks test recording playback in ci/cd for azure-cli-extension #27153

Open KalpeshChavan12 opened 1 year ago

KalpeshChavan12 commented 1 year ago

Describe the bug

Backgroup: While working on Maintenance RP CLI development. Test was recorded using following cmmand with latest azure-cli and azure-cli-extension repo.

While recording test for maintenance rp, thre was no get request for resource group for each following command

  1. az vm create,
  2. az vm host create
  3. az maintenance configuration create
  4. az maintenance assignment create
  5. az maintenance applyupdate create

How to reproduce

  1. clone azure-cli and azure-clie-extension (PR: https://github.com/Azure/azure-cli-extensions/pull/6589) e.g. from recording (manually added recoding to fix issue)
  2. Record test case
  3. run test in playback mode (azdev maintenance test)
  4. remove ~/.azure dir
  5. run test case for maintenace module (test failed)
- request:
    body: null
    headers:
      Accept:
      - application/json
      Accept-Encoding:
      - gzip, deflate
      CommandName:
      - az maintenance configuration create
      Connection:
      - keep-alive
      ParameterSetName:
      - --location --maintenance-scope --maintenance-window-duration --maintenance-window-expiration-date-time
        --maintenance-window-recur-every --maintenance-window-start-date-time --maintenance-window-time-zone
        --namespace --visibility --resource-group --resource-name
      User-Agent:
      - AZURECLI/2.51.0 azsdk-python-azure-mgmt-resource/23.1.0b2 Python/3.9.13 (Windows-10-10.0.22621-SP0)
    method: GET
    uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/clitest000001?api-version=2022-09-01
  response:
    body:
      string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001","name":"clitest000001","type":"Microsoft.Resources/resourceGroups","location":"eastus2euap","tags":{"product":"azurecli","cause":"automation","test":"test_maintenance_Scenario","date":"2023-08-11T04:00:34Z","module":"maintenance"},"properties":{"provisioningState":"Succeeded"}}'
    headers:
      cache-control:
      - no-cache
      content-length:
      - '367'
      content-type:
      - application/json; charset=utf-8
      date:
      - Fri, 11 Aug 2023 04:00:36 GMT
      expires:
      - '-1'
      pragma:
      - no-cache
      strict-transport-security:
      - max-age=31536000; includeSubDomains
      vary:
      - Accept-Encoding
      x-content-type-options:
      - nosniff
    status:
      code: 200
      message: OK

Related command

az vm create az vm host create az maintenance configuration create az maintenance assignment create az maintenance applyupdate create

Errors

azdev test maintenance failed.

Issue script & Debug output

Expected behavior

https://github.com/Azure/azure-cli-extensions/pull/6589/checks?check_run_id=15566022402

Test should pass and CLI should not check resource group for create command

Environment Summary

(clienv) kachavan@kachavan-Virtual-Machine:~/clidev/azure-cli-extensions$ az --version /home/kachavan/pyenv/clienv/bin/az:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import('pkg_resources').require('azure-cli==2.51.0') azure-cli 2.51.0

core 2.51.0 telemetry 1.1.0

Extensions: maintenance 1.4.0 (dev) /media/kachavan/extdrive/clidev/azure-cli-extensions/src/maintenance

Dependencies: msal 1.24.0b1 azure-mgmt-resource 23.1.0b2

Python location '/home/kachavan/pyenv/clienv/bin/python' Extensions directory '/home/kachavan/.azure/cliextensions' Development extension sources: /media/kachavan/extdrive/clidev/azure-cli-extensions

Python (Linux) 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

microsoft-github-policy-service[bot] commented 1 year ago

Thank you for your feedback. This has been routed to the support team for assistance.