From d359cbc1e0fcc979632572fc6ccfce6fcb0c02cb Mon Sep 17 00:00:00 2001 From: sofiar-msft Date: Fri, 6 Oct 2023 13:25:16 -0600 Subject: [PATCH] Add livetests to PPE (#39110) * 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 --- .../phone-numbers-livetest-matrix.json | 23 +++--- .../tests.yml | 9 ++- .../SipRouting/SipRoutingClientLiveTests.cs | 72 +++++++++++++++++++ 3 files changed, 95 insertions(+), 9 deletions(-) diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/phone-numbers-livetest-matrix.json b/sdk/communication/Azure.Communication.PhoneNumbers/phone-numbers-livetest-matrix.json index 2dc549218955b..2d3ba82c59731 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/phone-numbers-livetest-matrix.json +++ b/sdk/communication/Azure.Communication.PhoneNumbers/phone-numbers-livetest-matrix.json @@ -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": [ @@ -68,6 +74,7 @@ } }, "SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "FALSE", + "SKIP_SIPROUTING_LIVE_TESTS": "FALSE", "AZURE_TEST_AGENT": "WINDOWS_2019_NETCORE31" } ] diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/tests.yml b/sdk/communication/Azure.Communication.PhoneNumbers/tests.yml index 03f20ae83c7f6..f3751b546467d 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/tests.yml +++ b/sdk/communication/Azure.Communication.PhoneNumbers/tests.yml @@ -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: diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/tests/SipRouting/SipRoutingClientLiveTests.cs b/sdk/communication/Azure.Communication.PhoneNumbers/tests/SipRouting/SipRoutingClientLiveTests.cs index 2d24597e3f7c9..12a0ba6b00952 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/tests/SipRouting/SipRoutingClientLiveTests.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/tests/SipRouting/SipRoutingClientLiveTests.cs @@ -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 @@ -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() { @@ -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); @@ -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); @@ -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; @@ -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 { TestData!.RuleWithoutTrunks }).ConfigureAwait(false); var response = await client.GetRoutesAsync().ConfigureAwait(false); @@ -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); @@ -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(); @@ -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()); @@ -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); @@ -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 { TestData!.RuleWithoutTrunks }).ConfigureAwait(false); @@ -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()).ConfigureAwait(false); // Need to clear the routes first @@ -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(); @@ -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(); @@ -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 { TestData!.RuleWithoutTrunks }).Wait(); @@ -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();