Azure / Azure/azure-cli

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

Open
#28,465 3 comments 0 reactions 2 assignees Claimed by @evelyn-ys View on GitHub
Auto-Resolve Azure CLI Team common issue feature-request Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

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 () 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 - ().
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 - ().
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 - ().
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 - ().
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
1. https://github.com/Azure/azure-cli/pull/28273#discussion_r1502267008, fixed by https://github.com/Azure/azure-cli/pull/28456

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.