[Test Proxy] Unexpected behavior with breadcrumb/directory mismatches.
- Dominant language
- C#
- Stars
- 135
- Forks
- 260
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 144
Description
I believe test-proxy should reconcile the case where the breadcrumb exists, but the associated directory does not exist.
In my case, I had recorded some live tests for an SDK, but then decided I didn't need the new recordings anymore. So, I thought "I will just delete the directory that corresponds to my service in the `.assets` directory, then a re-run of the tests should pull the recordings from the assets repo automatically". However, doing so, gave me `Recording file path ... does not exist" when rerunning the tests.
Next, I tried running the `test-proxy restore` command:
```sh
~/dev/pvaneck/azure-sdk-for-python/sdk/monitor/azure-monitor-query$ test-proxy restore --assets-json-path assets.json
Running proxy version is Azure.Sdk.Tools.TestProxy 20231030.1
git --version
```
That just left me with an empty hash directory; (i.e. `TupQARQdFF`).
Next, I tried `test-proxy reset` and got the following exception:
```sh
Unhandled exception: Azure.Sdk.Tools.TestProxy.Common.Exceptions.HttpException: Invocation of "git checkout ." had a non-zero exit code -1.
StdOut:
StdErr: error: pathspec '.' did not match any file(s) known to git
at Azure.Sdk.Tools.TestProxy.Store.GitStore.Clean(GitAssetsConfiguration config) in /mnt/vss/_work/1/s/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs:line 260
at Azure.Sdk.Tools.TestProxy.Store.GitStore.Reset(String pathToAssetsJson) in /mnt/vss/_work/1/s/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs:line 241
at Azure.Sdk.Tools.TestProxy.Startup.Run(Object commandObj) in /mnt/vss/_work/1/s/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Startup.cs:line 108
at Azure.Sdk.Tools.TestProxy.CommandOptions.OptionsGenerator.<>c__DisplayClass0_0.<b__10>d.MoveNext() in /mnt/vss/_work/1/s/tools/test-proxy/Azure.Sdk.Tools.TestProxy/CommandOptions/OptionsGenerator.cs:line 110
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<b__0>d.MoveNext()
```
This also changed the `remote.origin.url` git config to the assets repo url. Had to change it back with `git remote set-url origin git@github.com:pvaneck/azure-sdk-for-python.git`
In the end, deleting the corresponding breadcrumb file got me back into the expected state, and all commands work again. This might be an edge case spurred by unexpected usage, but it would be nice for test-proxy to handle the case where the breadcrumb exists but the directory does not.
Contributor guide
Research direction
Reproduce the mismatch by deleting the service directory under .assets while leaving its breadcrumb, then run test-proxy restore and test-proxy reset with assets.json. Start in Azure.Sdk.Tools.TestProxy/Store/GitStore.cs, especially Reset and Clean at the stack-trace locations. Done means the breadcrumb and missing-directory state is handled without the recording-path error, empty hash directory, or reset exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100