Skip to content

Commit cbe2382

Browse files
FixGetRecordingTest (#50222)
* Fixed Sanitation Issue * Update other tests * Fix for other affected test * Fix Playback Sanitation * Decrease time * Shorten Time * Re-recorded tests
1 parent c7adb9f commit cbe2382

File tree

10 files changed

+774
-303
lines changed

10 files changed

+774
-303
lines changed

sdk/communication/Azure.Communication.CallAutomation/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "net",
44
"TagPrefix": "net/communication/Azure.Communication.CallAutomation",
5-
"Tag": "net/communication/Azure.Communication.CallAutomation_fdf269ce94"
5+
"Tag": "net/communication/Azure.Communication.CallAutomation_9cd8b0cf91"
66
}

sdk/communication/Azure.Communication.CallAutomation/tests/CallConnections/CallConnectionAutomatedLiveTests.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ public async Task RemoveAUserCallTest()
7878
};
7979
Response<RemoveParticipantResult> removePartResponse = await response.CallConnection.RemoveParticipantAsync(removeParticipantsOptions);
8080
Assert.IsTrue(!removePartResponse.GetRawResponse().IsError);
81-
Assert.AreEqual(operationContext1, removePartResponse.Value.OperationContext);
81+
string expectedOperationContext = Mode == RecordedTestMode.Playback ? "Sanitized" : operationContext1;
82+
Assert.AreEqual(expectedOperationContext, removePartResponse.Value.OperationContext);
8283

8384
// call should be disconnected after removing participant
8485
var disconnectedEvent = await WaitForEvent<CallDisconnected>(callConnectionId, TimeSpan.FromSeconds(20));
@@ -157,7 +158,9 @@ public async Task CancelAddParticipantTest()
157158
OperationContext = operationContext,
158159
};
159160
var addParticipantResponse = await callConnection.AddParticipantAsync(addParticipantOptions);
160-
Assert.AreEqual(operationContext, addParticipantResponse.Value.OperationContext);
161+
162+
string expectedOperationContext = Mode == RecordedTestMode.Playback ? "Sanitized" : operationContext;
163+
Assert.AreEqual(expectedOperationContext, addParticipantResponse.Value.OperationContext);
161164
Assert.IsNotNull(addParticipantResponse.Value.InvitationId);
162165

163166
// ensure invitation has arrived

sdk/communication/Azure.Communication.CallAutomation/tests/CallRecordings/CallRecordingAutomatedLiveTests.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ public async Task StartRecordingWithCallConnectionIdTest()
404404
}
405405
}
406406

407-
[Ignore(reason: "Skipping this currently getrecording api taking more than 2 mints to get the recording result")]
408407
[RecordedTest]
409408
public async Task GetRecordingTest()
410409
{
@@ -418,6 +417,7 @@ public async Task GetRecordingTest()
418417
* 7. hang up the call.
419418
* 8. once call is hung up, verify disconnected event
420419
*/
420+
421421
// create caller and receiver
422422
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);
423423
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
@@ -472,10 +472,19 @@ public async Task GetRecordingTest()
472472
Assert.AreEqual(StatusCodes.Status200OK, startRecordingResponse.GetRawResponse().Status);
473473
Assert.NotNull(startRecordingResponse.Value.RecordingId);
474474

475+
var playSource = new FileSource(new Uri(TestEnvironment.FileSourceUrl)) { PlaySourceCacheId = "test-audio" };
476+
var playResponse = await response.CallConnection.GetCallMedia().PlayToAllAsync(playSource);
477+
Assert.NotNull(playResponse);
478+
Assert.AreEqual(202, playResponse.GetRawResponse().Status);
479+
480+
await Task.Delay(TimeSpan.FromSeconds(5)).ConfigureAwait(false);
481+
475482
// try stop recording
476483
var stopRecordingResponse = await client.GetCallRecording().StopAsync(startRecordingResponse.Value.RecordingId);
477484
Assert.AreEqual(StatusCodes.Status204NoContent, stopRecordingResponse.Status);
478485

486+
await Task.Delay(TimeSpan.FromSeconds(5)).ConfigureAwait(false);
487+
479488
// get call recording result
480489
var recordingResult = await client.GetCallRecording().GetRecordingAsync(startRecordingResponse.Value.RecordingId).ConfigureAwait(false);
481490
Assert.NotNull(recordingResult.Value);
@@ -486,7 +495,7 @@ public async Task GetRecordingTest()
486495

487496
// try hangup
488497
await response.CallConnection.HangUpAsync(true).ConfigureAwait(false);
489-
var disconnectedEvent = await WaitForEvent<CallDisconnected>(callConnectionId, TimeSpan.FromSeconds(20));
498+
var disconnectedEvent = await WaitForEvent<CallDisconnected>(callConnectionId, TimeSpan.FromSeconds(5));
490499
Assert.IsNotNull(disconnectedEvent);
491500
Assert.IsTrue(disconnectedEvent is CallDisconnected);
492501
Assert.IsTrue(((CallDisconnected)disconnectedEvent!).CallConnectionId == callConnectionId);

sdk/communication/Azure.Communication.CallAutomation/tests/Infrastructure/CallAutomationClientAutomatedLiveTestsBase.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public CallAutomationClientAutomatedLiveTestsBase(bool isAsync, RecordedTestMode
6060
BodyKeySanitizers.Add(new BodyKeySanitizer("..recordingStateCallbackUri") { Value = @"https://sanitized.skype.com/api/servicebuscallback/events" });
6161
BodyKeySanitizers.Add(new BodyKeySanitizer("..transportUrl") { Value = @"wss://sanitized.skype.com" });
6262
BodyKeySanitizers.Add(new BodyKeySanitizer("..cognitiveServicesEndpoint") { Value = @"https://sanitized.skype.com" });
63-
BodyKeySanitizers.Add(new BodyKeySanitizer("$..file.uri") { Value = @"https://sanitized.skype.com/prompt.wav" });
63+
BodyKeySanitizers.Add(new BodyKeySanitizer("$..operationContext") { Value = "Sanitized" });
64+
BodyKeySanitizers.Add(new BodyKeySanitizer("$..file.uri") { Value = @"https://sanitized.skype.com/prompt.wav" });
6465
BodyRegexSanitizers.Add(new BodyRegexSanitizer(TestDispatcherRegEx) { Value = "https://sanitized.skype.com" });
6566
UriRegexSanitizers.Add(new UriRegexSanitizer(URIDomainRegEx) { Value = "https://sanitized.skype.com" });
6667
UriRegexSanitizers.Add(new UriRegexSanitizer(TestDispatcherQNameRegEx) { Value = SanitizeValue });

0 commit comments

Comments
 (0)