Skip to content

Commit

Permalink
Fixing automated tests (#34348)
Browse files Browse the repository at this point in the history
Co-authored-by: Min Woo Lee 🧊 <[email protected]>
  • Loading branch information
minwoolee-msft and minwoolee-msft authored Feb 17, 2023
1 parent 71c45d0 commit 87d1753
Show file tree
Hide file tree
Showing 29 changed files with 796 additions and 4,385 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
</ItemGroup>
<ItemGroup>
<Folder Include="SessionRecordedEvents\" />
<Folder Include="SessionRecordedEvents\CallAutomationClientAutomatedLiveTests\" />
<Folder Include="SessionRecordedEvents\CallConnectionAutomatedLiveTests\" />
<Folder Include="SessionRecordedEvents\CallRecordingAutomatedLiveTests\" />
<Folder Include="SessionRecords\CallAutomationClientAutomatedLiveTests\" />
<Folder Include="SessionRecords\CallConnectionAutomatedLiveTests\" />
<Folder Include="SessionRecords\CallRecordingAutomatedLiveTests\" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ public async Task CreateCallToACSGetCallAndHangUpCallTest()
* 5. once call is hung up, verify disconnected event
*/

// create caller and receiver
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target);
string? callConnectionId = null;

try
{
// create caller and receiver
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
string? callConnectionId = null;

try
{
// setup service bus
Expand All @@ -52,7 +53,7 @@ public async Task CreateCallToACSGetCallAndHangUpCallTest()

// answer the call
var answerCallOptions = new AnswerCallOptions(incomingCallContext, new Uri(TestEnvironment.DispatcherCallback));
AnswerCallResult answerResponse = await client.AnswerCallAsync(answerCallOptions);
AnswerCallResult answerResponse = await targetClient.AnswerCallAsync(answerCallOptions);

// wait for callConnected
var connectedEvent = await WaitForEvent<CallConnected>(callConnectionId, TimeSpan.FromSeconds(20));
Expand All @@ -77,15 +78,15 @@ public async Task CreateCallToACSGetCallAndHangUpCallTest()
{
throw;
}
finally
{
await CleanUpCall(client, callConnectionId);
}
}
catch (Exception ex)
{
Assert.Fail($"Unexpected error: {ex}");
}
finally
{
await CleanUpCall(client, callConnectionId);
}
}

[RecordedTest]
Expand All @@ -99,13 +100,13 @@ public async Task CreateCallAndReject()
*/

// create caller and receiver
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);
CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
string? callConnectionId = null;

try
{
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);
CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
string? callConnectionId = null;

try
{
// setup service bus
Expand Down Expand Up @@ -148,15 +149,15 @@ public async Task CreateCallAndReject()
{
throw;
}
finally
{
await CleanUpCall(client, callConnectionId);
}
}
catch (Exception ex)
{
Assert.Fail($"Unexpected error: {ex}");
}
finally
{
await CleanUpCall(client, callConnectionId);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ public async Task RemoveAUserCallTest()
* 5. Check the call if the call is terminated.
*/

// create caller and receiver
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);
CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target);
string? callConnectionId = null;

try
{
// create caller and receiver
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);

CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
string? callConnectionId = null;

try
{
// setup service bus
Expand All @@ -53,7 +53,7 @@ public async Task RemoveAUserCallTest()

// answer the call
var answerCallOptions = new AnswerCallOptions(incomingCallContext, new Uri(TestEnvironment.DispatcherCallback));
AnswerCallResult answerResponse = await client.AnswerCallAsync(answerCallOptions);
AnswerCallResult answerResponse = await targetClient.AnswerCallAsync(answerCallOptions);

// wait for callConnected
var connectedEvent = await WaitForEvent<CallConnected>(callConnectionId, TimeSpan.FromSeconds(20));
Expand Down Expand Up @@ -91,15 +91,15 @@ public async Task RemoveAUserCallTest()
{
throw;
}
finally
{
await CleanUpCall(client, callConnectionId);
}
}
catch (Exception ex)
{
Assert.Fail($"Unexpected error: {ex}");
}
finally
{
await CleanUpCall(client, callConnectionId);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public CallRecordingAutomatedLiveTests(bool isAsync) : base(isAsync)
{
}

[Ignore (reason: "Recording is currently broken with error Removing modality controller as this conversation has ended. Waiting on fix for this")]
[RecordedTest]
public async Task RecordingOperationsTest()
{
Expand All @@ -26,6 +27,7 @@ public async Task RecordingOperationsTest()
var user = await CreateIdentityUserAsync().ConfigureAwait(false);

CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target);
bool stopRecording = false;

// setup service bus
Expand All @@ -43,7 +45,7 @@ public async Task RecordingOperationsTest()

// answer the call
var answerCallOptions = new AnswerCallOptions(incomingCallContext, new Uri(TestEnvironment.DispatcherCallback));
var answerResponse = await client.AnswerCallAsync(answerCallOptions);
var answerResponse = await targetClient.AnswerCallAsync(answerCallOptions);
Assert.AreEqual(answerResponse.GetRawResponse().Status, StatusCodes.Status200OK);

// wait for callConnected
Expand Down Expand Up @@ -113,6 +115,7 @@ public async Task RecordingOperationsTest()
}
}

[Ignore(reason: "Recording is currently broken with error Removing modality controller as this conversation has ended. Waiting on fix for this")]
[RecordedTest]
public async Task CreateACSCallAndUnmixedAudioTest()
{
Expand All @@ -126,14 +129,15 @@ public async Task CreateACSCallAndUnmixedAudioTest()
* 7. once call is hung up, verify disconnected event
*/

// create caller and receiver
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target);
string? callConnectionId = null;

try
{
// create caller and receiver
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
string? callConnectionId = null;

try
{
// setup service bus
Expand All @@ -151,7 +155,7 @@ public async Task CreateACSCallAndUnmixedAudioTest()

// answer the call
var answerCallOptions = new AnswerCallOptions(incomingCallContext, new Uri(TestEnvironment.DispatcherCallback));
var answerResponse = await client.AnswerCallAsync(answerCallOptions);
var answerResponse = await targetClient.AnswerCallAsync(answerCallOptions);
Assert.AreEqual(answerResponse.GetRawResponse().Status, StatusCodes.Status200OK);

// wait for callConnected
Expand Down Expand Up @@ -199,17 +203,18 @@ public async Task CreateACSCallAndUnmixedAudioTest()
{
throw;
}
finally
{
await CleanUpCall(client, callConnectionId);
}
}
catch (Exception ex)
{
Assert.Fail($"Unexpected error: {ex}");
}
finally
{
await CleanUpCall(client, callConnectionId);
}
}

[Ignore(reason: "Recording is currently broken with error Removing modality controller as this conversation has ended. Waiting on fix for this")]
[RecordedTest]
public async Task CreateACSCallUnmixedAudioAffinityTest()
{
Expand All @@ -223,13 +228,14 @@ public async Task CreateACSCallUnmixedAudioAffinityTest()
* 7. once call is hung up, verify disconnected event
*/
// create caller and receiver
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
CallAutomationClient targetClient = CreateInstrumentedCallAutomationClientWithConnectionString(target);
string? callConnectionId = null;

try
{
CommunicationUserIdentifier target = await CreateIdentityUserAsync().ConfigureAwait(false);
CommunicationUserIdentifier user = await CreateIdentityUserAsync().ConfigureAwait(false);
CallAutomationClient client = CreateInstrumentedCallAutomationClientWithConnectionString(user);
string? callConnectionId = null;

try
{
// setup service bus
Expand All @@ -247,7 +253,7 @@ public async Task CreateACSCallUnmixedAudioAffinityTest()

// answer the call
var answerCallOptions = new AnswerCallOptions(incomingCallContext, new Uri(TestEnvironment.DispatcherCallback));
var answerResponse = await client.AnswerCallAsync(answerCallOptions);
var answerResponse = await targetClient.AnswerCallAsync(answerCallOptions);
Assert.AreEqual(answerResponse.GetRawResponse().Status, StatusCodes.Status200OK);

// wait for callConnected
Expand Down Expand Up @@ -298,15 +304,15 @@ public async Task CreateACSCallUnmixedAudioAffinityTest()
{
throw;
}
finally
{
await CleanUpCall(client, callConnectionId);
}
}
catch (Exception ex)
{
Assert.Fail($"Unexpected error: {ex}");
}
finally
{
await CleanUpCall(client, callConnectionId);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ protected CallAutomationClient CreateInstrumentedCallAutomationClientWithConnect
{
callAutomationClient = new CallAutomationClient(new Uri(TestEnvironment.PMAEndpoint), connectionString, CreateServerCallingClientOptionsWithCorrelationVectorLogs(source));
}
//callAutomationClient = new CallAutomationClient(new Uri("https://pma-dev-fmorales.plat-dev.skype.net"), connectionString, CreateServerCallingClientOptionsWithCorrelationVectorLogs());

return InstrumentClient(callAutomationClient);
}
Expand Down
Loading

0 comments on commit 87d1753

Please sign in to comment.