Skip to content

Commit 78fe52b

Browse files
Throw exception if options have already been instrumented (Azure#33828)
1 parent f2ccc5c commit 78fe52b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sdk/core/Azure.Core.TestFramework/src/TestRecording.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,9 @@ public HttpPipelineTransport CreateTransport(HttpPipelineTransport currentTransp
262262
{
263263
if (currentTransport is ProxyTransport)
264264
{
265-
//TODO: https://github.com/Azure/azure-sdk-for-net/issues/30029
266-
return currentTransport;
265+
throw new InvalidOperationException(
266+
"The supplied options have already been instrumented. Each test must pass a unique options instance to " +
267+
"InstrumentClientOptions.");
267268
}
268269
return new ProxyTransport(_proxy, currentTransport, this, () => _disableRecording.Value);
269270
}

sdk/resourcemanager/Azure.ResourceManager/tests/Scenario/ClientContextTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public async Task ValidateOptionsTestApiVersions()
7575
Assert.AreNotEqual(versionY, fakeVersion);
7676
Assert.AreNotEqual(versionX, fakeVersion);
7777

78+
x = new ArmClientOptions();
7879
x.SetApiVersion(ResourceGroupResource.ResourceType, fakeVersion);
7980
clientX = GetArmClient(x);
8081
subX = await clientX.GetDefaultSubscriptionAsync();

0 commit comments

Comments
 (0)