azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Conflicting PRs leads to `CannotOverwriteExistingCassetteException`, `No match for the request ...`

Open jiasli opened this issue 11 months ago • 3 comments

CI failures CannotOverwriteExistingCassetteException, No match for the request ... happens when:

  • PR A bumps the API version for existing requests in a recording YAML, such as from 2023-11-01 to 2024-01-01
  • PR B adds new requests to the recording YAML with the old API version, such as 2023-11-01
============== PR A ===============
request 1: 2023-11-01 -> 2024-01-01
request 2: 2023-11-01 -> 2024-01-01
request 3: 2023-11-01 -> 2024-01-01
============== PR B ===============
request 4:             + 2023-11-01
request 5:             + 2023-11-01
request 6:             + 2023-11-01

Each PR's CI can pass individually.

As adding new lines won't cause merge conflict, both PRs can be merged, but triggers CI failure after merging because of the inconsistent API versions:

2024-02-26T08:30:09.3934011Z         except CannotOverwriteExistingCassetteException as ex:
2024-02-26T08:30:09.3934190Z >           raise AssertionError(ex)
2024-02-26T08:30:09.3934901Z E           AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_create_loadbalancer_then_update.yaml') in your current record mode ('once').
2024-02-26T08:30:09.3935712Z E           No match for the request (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000002?api-version=2024-01-01>) was found.
2024-02-26T08:30:09.3936084Z E           Found 4 similar requests with 0 different matcher(s) :
2024-02-26T08:30:09.3936233Z E           
2024-02-26T08:30:09.3936782Z E           1 - (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000002?api-version=2024-01-01>).
2024-02-26T08:30:09.3937361Z E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path', '_custom_request_query_matcher']
2024-02-26T08:30:09.3937574Z E           Matchers failed :
2024-02-26T08:30:09.3937698Z E           
2024-02-26T08:30:09.3938257Z E           2 - (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000002?api-version=2024-01-01>).
2024-02-26T08:30:09.3938785Z E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path', '_custom_request_query_matcher']
2024-02-26T08:30:09.3938994Z E           Matchers failed :
2024-02-26T08:30:09.3939120Z E           
2024-02-26T08:30:09.3939687Z E           3 - (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000002?api-version=2024-01-01>).
2024-02-26T08:30:09.3940242Z E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path', '_custom_request_query_matcher']
2024-02-26T08:30:09.3940465Z E           Matchers failed :
2024-02-26T08:30:09.3940591Z E           
2024-02-26T08:30:09.3941175Z E           4 - (<Request (GET) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000002?api-version=2024-01-01>).
2024-02-26T08:30:09.3941718Z E           Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path', '_custom_request_query_matcher']
2024-02-26T08:30:09.3941942Z E           Matchers failed :

Previous occurrences:

  1. https://github.com/Azure/azure-cli/pull/19003#issuecomment-887348885
  2. https://github.com/Azure/azure-cli/pull/28273#discussion_r1502267008, fixed by https://github.com/Azure/azure-cli/pull/28456

jiasli avatar Feb 27 '24 04:02 jiasli

Hi @jiasli Find similar issue https://github.com/Azure/azure-cli/issues/7819.

Issue title Enable logging to file causes some recorded tests to fail.
Create time 2018-11-12
Comment number 1

Please confirm if this resolves your issue.

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

yonzhan avatar Feb 27 '24 04:02 yonzhan

https://github.com/Azure/azure-cli/pull/28218

jsntcy avatar Mar 01 '24 07:03 jsntcy