Skip to content

Commit b4cc07d

Browse files
[Recorder] Bug Fix - Passing recordingId to the proxy tool as expected (Azure#20393)
1 parent 07f5165 commit b4cc07d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

sdk/test-utils/recorder/src/sanitizer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ async function addSanitizer(
259259
const uri = `${url}${paths.admin}${
260260
options.sanitizer !== "Reset" ? paths.addSanitizer : paths.reset
261261
}`;
262-
const req = createRecordingRequest(uri, recordingId);
262+
const req = createRecordingRequest(uri, undefined, recordingId);
263263
if (options.sanitizer !== "Reset") {
264264
req.headers.set("x-abstraction-identifier", options.sanitizer);
265265
}

sdk/test-utils/recorder/test/sanitizers.spec.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import { getTestServerUrl, makeRequestAndVerifyResponse, setTestMode } from "./u
1313
describe(`proxy tool - sanitizers`, () => {
1414
let recorder: Recorder;
1515
let client: ServiceClient;
16+
const fakeSecretValue = "fake_secret_info";
17+
const secretValue = "abcdef";
18+
let currentValue: string;
1619

1720
before(() => {
1821
setTestMode(mode);
@@ -21,6 +24,7 @@ import { getTestServerUrl, makeRequestAndVerifyResponse, setTestMode } from "./u
2124
beforeEach(async function () {
2225
recorder = new Recorder(this.currentTest);
2326
client = new ServiceClient(recorder.configureClientOptions({ baseUri: getTestServerUrl() }));
27+
currentValue = isPlaybackMode() ? fakeSecretValue : secretValue;
2428
});
2529

2630
afterEach(async () => {
@@ -36,16 +40,16 @@ import { getTestServerUrl, makeRequestAndVerifyResponse, setTestMode } from "./u
3640
{
3741
regex: true,
3842
target: "abc+def",
39-
value: "fake_secret_info",
43+
value: fakeSecretValue,
4044
},
4145
],
4246
},
4347
});
4448
await makeRequestAndVerifyResponse(
4549
client,
4650
{
47-
path: `/sample_response/abcdef`,
48-
body: "abcdef",
51+
path: `/sample_response/${currentValue}`,
52+
body: currentValue,
4953
method: "POST",
5054
},
5155
{ val: "I am the answer!" }
@@ -58,17 +62,17 @@ import { getTestServerUrl, makeRequestAndVerifyResponse, setTestMode } from "./u
5862
sanitizerOptions: {
5963
generalSanitizers: [
6064
{
61-
target: "abcdef",
62-
value: "fake_secret_info",
65+
target: currentValue,
66+
value: fakeSecretValue,
6367
},
6468
],
6569
},
6670
});
6771
await makeRequestAndVerifyResponse(
6872
client,
6973
{
70-
path: `/sample_response/abcdef`,
71-
body: "abcdef",
74+
path: `/sample_response/${currentValue}`,
75+
body: currentValue,
7276
method: "POST",
7377
},
7478
{ val: "I am the answer!" }
@@ -93,7 +97,6 @@ import { getTestServerUrl, makeRequestAndVerifyResponse, setTestMode } from "./u
9397

9498
it("BodyKeySanitizer", async () => {
9599
const secretValue = "ab12cd34ef";
96-
const fakeSecretValue = "fake_secret_info";
97100
await recorder.start({
98101
envSetupForPlayback: {},
99102
sanitizerOptions: {
@@ -128,7 +131,6 @@ import { getTestServerUrl, makeRequestAndVerifyResponse, setTestMode } from "./u
128131

129132
it("BodyRegexSanitizer", async () => {
130133
const secretValue = "ab12cd34ef";
131-
const fakeSecretValue = "fake_secret_info";
132134
await recorder.start({
133135
envSetupForPlayback: {},
134136
sanitizerOptions: {
@@ -290,7 +292,6 @@ import { getTestServerUrl, makeRequestAndVerifyResponse, setTestMode } from "./u
290292

291293
it.skip("ResetSanitizer (uses BodyRegexSanitizer as example)", async () => {
292294
const secretValue = "ab12cd34ef";
293-
const fakeSecretValue = "fake_secret_info";
294295
await recorder.start({
295296
envSetupForPlayback: {},
296297
sanitizerOptions: {

0 commit comments

Comments
 (0)