Skip to content

Commit

Permalink
Add livetests to PPE (Azure#39110)
Browse files Browse the repository at this point in the history
* Update tests.yml

* Skip SIP tests on int and ppe

* Skip SIP tests on ppe

* Add flag to skip sip configuration tests

* Add flag to skip sip configuration in matrix

* Update to net462

* Remove Siprounting flag

* Remove Siprounting flag from matrix

* Add Siprounting flag to matrix
  • Loading branch information
sofiar-msft authored and matthohn-msft committed Oct 27, 2023
1 parent 9a40a05 commit d359cbc
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,47 @@
"OSVmImage": "MMSUbuntu20.04",
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
"TestTargetFramework": "net7.0",
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE"
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE",
"SKIP_SIPROUTING_LIVE_TESTS": "TRUE"
},
"Ubuntu-20.04_NET6.0": {
"OSVmImage": "MMSUbuntu20.04",
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
"TestTargetFramework": "net6.0",
"AZURE_TEST_AGENT": "UBUNTU_2004_NET60",
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "FALSE"
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "FALSE",
"SKIP_SIPROUTING_LIVE_TESTS": "TRUE"
},

"windows2022_NET6.0": {
"OSVmImage": "windows-2022",
"Pool": "azsdk-pool-mms-win-2022-general",
"TestTargetFramework": "net6.0",
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE"
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE",
"SKIP_SIPROUTING_LIVE_TESTS": "TRUE"
},
"windows2022_NET461": {
"windows2022_NET462": {
"OSVmImage": "windows-2022",
"Pool": "azsdk-pool-mms-win-2022-general",
"TestTargetFramework": "net461",
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE"
"TestTargetFramework": "net462",
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE",
"SKIP_SIPROUTING_LIVE_TESTS": "TRUE"
},

"macos-11_NET7.0": {
"OSVmImage": "macos-11",
"Pool": "Azure Pipelines",
"TestTargetFramework": "net7.0",
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE"
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE",
"SKIP_SIPROUTING_LIVE_TESTS": "TRUE"
},
"macos-11_NET6.0": {
"OSVmImage": "macos-11",
"Pool": "Azure Pipelines",
"TestTargetFramework": "net6.0",
"AZURE_TEST_AGENT": "MACOS_1015_NET60",
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "FALSE"
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "FALSE",
"SKIP_SIPROUTING_LIVE_TESTS": "TRUE"
}
},
"AdditionalTestArguments": [
Expand All @@ -68,6 +74,7 @@
}
},
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "FALSE",
"SKIP_SIPROUTING_LIVE_TESTS": "FALSE",
"AZURE_TEST_AGENT": "WINDOWS_2019_NETCORE31"
}
]
Expand Down
9 changes: 8 additions & 1 deletion sdk/communication/Azure.Communication.PhoneNumbers/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@ extends:
- $(sub-config-azure-cloud-test-resources)
- $(sub-config-communication-services-cloud-test-resources-common)
- $(sub-config-communication-services-cloud-test-resources-net)
PPE:
SubscriptionConfigurations:
- $(sub-config-communication-ppe-test-resources-common)
- $(sub-config-communication-ppe-test-resources-net)
MatrixReplace:
- SKIP_UPDATE_CAPABILITIES_LIVE_TESTS=FALSE/TRUE
- SKIP_SIPROUTING_LIVE_TESTS=FALSE/TRUE
Int:
SubscriptionConfigurations:
- $(sub-config-communication-int-test-resources-common)
- $(sub-config-communication-int-test-resources-net)
MatrixReplace:
- SKIP_UPDATE_CAPABILITIES_LIVE_TESTS=FALSE/TRUE
Clouds: Public,Int
Clouds: Public, PPE, Int
TestResourceDirectories:
- communication/test-resources/
EnvVars:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Azure.Core.Pipeline;
using Azure.Core.TestFramework;
using NUnit.Framework;

namespace Azure.Communication.PhoneNumbers.SipRouting.Tests
Expand All @@ -18,6 +20,8 @@ public class SipRoutingClientLiveTests : SipRoutingClientLiveTestBase
public SipRoutingClientLiveTests(bool isAsync) : base(isAsync)
{
}
public bool SkipSipConfigurationLiveTest
=> TestEnvironment.Mode != RecordedTestMode.Playback && Environment.GetEnvironmentVariable("SKIP_SIPROUTING_LIVE_TESTS") == "TRUE";

public SipRoutingClient InitializeTest()
{
Expand All @@ -40,6 +44,11 @@ public async Task ClearConfiguration()
[Test]
public async Task GetFunctionUsingTokenAuthentication()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = CreateClientWithTokenCredential();

var response = await client.GetTrunksAsync().ConfigureAwait(false);
Expand All @@ -49,6 +58,11 @@ public async Task GetFunctionUsingTokenAuthentication()
[Test]
public async Task SetFunctionUsingTokenAuthentication()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = CreateClientWithTokenCredential();

var response = await client.SetTrunkAsync(new SipTrunk(TestData!.TrunkList[0].Fqdn,5555)).ConfigureAwait(false);
Expand All @@ -58,6 +72,11 @@ public async Task SetFunctionUsingTokenAuthentication()
[Test]
public async Task GetSipTrunksForResource()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = InitializeTest();
var response = await client.GetTrunksAsync().ConfigureAwait(false);
var trunks = response.Value;
Expand All @@ -71,6 +90,11 @@ public async Task GetSipTrunksForResource()
[Test]
public async Task GetSipRoutesForResource()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = CreateClient();
await client.SetRoutesAsync(new List<SipTrunkRoute> { TestData!.RuleWithoutTrunks }).ConfigureAwait(false);
var response = await client.GetRoutesAsync().ConfigureAwait(false);
Expand All @@ -84,6 +108,11 @@ public async Task GetSipRoutesForResource()
[Test]
public async Task AddSipTrunkForResource()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = InitializeTest();
var response = await client.SetTrunkAsync(TestData!.NewTrunk).ConfigureAwait(false);
var actualTrunks = await client.GetTrunksAsync().ConfigureAwait(false);
Expand All @@ -95,6 +124,10 @@ public async Task AddSipTrunkForResource()
[Test]
public async Task SetSipTrunkForResource()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}
var modifiedTrunk = new SipTrunk(TestData!.TrunkList[0].Fqdn, 9999);
var client = InitializeTest();

Expand All @@ -107,6 +140,11 @@ public async Task SetSipTrunkForResource()
[Test]
public async Task DeleteSipTrunkForResource()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = InitializeTest();
var initialTrunks = await client.GetTrunksAsync().ConfigureAwait(false);
Assert.AreEqual(TestData!.TrunkList.Count, initialTrunks.Value.Count());
Expand All @@ -121,6 +159,11 @@ public async Task DeleteSipTrunkForResource()
[Test]
public async Task GetSipTrunkForResource()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = InitializeTest();

var response = await client.GetTrunkAsync(TestData!.TrunkList[1].Fqdn).ConfigureAwait(false);
Expand All @@ -133,6 +176,11 @@ public async Task GetSipTrunkForResource()
[Test]
public async Task ReplaceSipRoutesForResource()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = CreateClient();

await client.SetRoutesAsync(new List<SipTrunkRoute> { TestData!.RuleWithoutTrunks }).ConfigureAwait(false);
Expand All @@ -148,6 +196,10 @@ public async Task ReplaceSipRoutesForResource()
[Test]
public async Task ReplaceSipTrunksForResource()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}
var client = InitializeTest();

await client.SetRoutesAsync(new List<SipTrunkRoute>()).ConfigureAwait(false); // Need to clear the routes first
Expand All @@ -163,6 +215,11 @@ public async Task ReplaceSipTrunksForResource()
[Test]
public async Task ClearSipTrunksForResource()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = CreateClient();
client.SetTrunksAsync(TestData!.TrunkList).Wait();

Expand All @@ -177,6 +234,11 @@ public async Task ClearSipTrunksForResource()
[Test]
public async Task ClearSipTrunksForResourceWhenAlreadyEmpty()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = CreateClient();
await ClearConfiguration();

Expand All @@ -191,6 +253,11 @@ public async Task ClearSipTrunksForResourceWhenAlreadyEmpty()
[Test]
public async Task ClearSipRoutesForResource()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = CreateClient();
client.SetRoutesAsync(new List<SipTrunkRoute> { TestData!.RuleWithoutTrunks }).Wait();

Expand All @@ -205,6 +272,11 @@ public async Task ClearSipRoutesForResource()
[Test]
public async Task ClearSipRoutesForResourceWhenAlreadyEmpty()
{
if (SkipSipConfigurationLiveTest)
{
Assert.Ignore("Skip sip configuration flag is on.");
}

var client = CreateClient();
await ClearConfiguration();

Expand Down

0 comments on commit d359cbc

Please sign in to comment.