Azure / Azure/azure-sdk-tools

Allow overriding recording, playback response to simulate conditions

Open
#6,277 1 comment 0 reactions 0 assignees View on GitHub
Test-Proxy
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
143

Description

It's not uncommon to get a customer bug report and want to write a test for it. In .NET, I typically do this with a sequence of `MockResponse`s to simulate a condition that may be hard to set up in real life.

Using the Test Proxy, we have an opportunity to change the entire response based on some conditions. I did something like in github.com/heaths/azcrypto: https://github.com/heaths/azcrypto/blob/cb4a5ea0e92f35cebbdb9b06149712fbc686aa09/client_test.go#L270-L278

I want to simulate a 403 on a GET for a specific key. This affects the recording, such that the (then-live) client and the client playing back a cassette (what vcr / go-vcr calls their recording files) are congruent.

Test Proxy could do this, though for truly live scenarios it wouldn't be effective since it's not involved. But on that note, maybe we could also take a page from vcr and always record or playback, but just don't save the session when live. This would mitigate some issues we've discussed in the past when the Test Proxy isn't being used e.g., live sessions.

This would allow us to utilize the Test Proxy more to simulate situations that are hard to reproduce, like authentication issues under certain circumstances we can't easily simulate.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Test Proxy recording and playback flow, then inspect the referenced azcrypto client_test.go example for the MockResponse sequence. Determine how conditional response overrides could apply consistently while recording and playing back cassettes. Done means the Test Proxy can simulate conditions such as a 403 for a specific GET in both modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing-qa, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.