Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Communication] - Clean up communication pipeline parameters #21033

Merged
merged 2 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using Azure.Communication.Identity;
using Azure.Core.TestFramework;
using NUnit.Framework;

namespace Azure.Communication.Chat.Tests
{
Expand All @@ -12,16 +11,6 @@ public class ChatLiveTestBase : RecordedTestBase<ChatTestEnvironment>
public ChatLiveTestBase(bool isAsync) : base(isAsync)
=> Sanitizer = new ChatRecordedTestSanitizer();

[OneTimeSetUp]
public void Setup()
{
if (TestEnvironment.ShouldIgnoreTests)
{
Assert.Ignore("Chat tests are skipped " +
"because chat package is not included in the TEST_PACKAGES_ENABLED variable");
}
}

/// <summary>
/// Creates a <see cref="CommunicationIdentityClient" /> with the connectionstring via environment
/// variables and instruments it to make use of the Azure Core Test Framework functionalities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ namespace Azure.Communication.Chat.Tests
/// </summary>
public class ChatTestEnvironment : CommunicationTestEnvironment
{
// please find the allowed package value in tests.yml
private const string ChatTestPackagesEnabled = "chat";
public override string ExpectedTestPackagesEnabled { get { return ChatTestPackagesEnabled; } }
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
using System.Threading.Tasks;
using Azure.Communication.Identity;
using Azure.Core;
using Azure.Core.TestFramework;
using NUnit.Framework;

namespace Azure.Communication.Chat.Tests.samples
{
public partial class Sample1_ThreadOperations : ChatSampleBase
public partial class Sample1_ThreadOperations : SamplesBase<ChatTestEnvironment>
{
// This sample demonstrates the operations that can be performed on a thread: create, get, getThreads, update and delete.
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
using System.Threading.Tasks;
using Azure.Communication.Identity;
using Azure.Core;
using Azure.Core.TestFramework;
using NUnit.Framework;

namespace Azure.Communication.Chat.Tests.samples
{
public partial class Sample2_MessagingOperations : ChatSampleBase
public partial class Sample2_MessagingOperations : SamplesBase<ChatTestEnvironment>
{
// This sample demonstrates the messaging operations that can be performed on a thread: send, get, update, delete, typing notifications and readreceipts
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
using System.Threading.Tasks;
using Azure.Communication.Identity;
using Azure.Core;
using Azure.Core.TestFramework;
using NUnit.Framework;

namespace Azure.Communication.Chat.Tests.samples
{
public partial class Sample3_ParticipantOperations : ChatSampleBase
public partial class Sample3_ParticipantOperations : SamplesBase<ChatTestEnvironment>
{
// This sample demonstrates the operations that can be performed on a thread for participants: add, get and remove participants
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
//@@ using Azure.Communication.Chat;
#endregion Snippet:Azure_Communication_Chat_Tests_Samples_UsingStatements
using Azure.Core;
using Azure.Core.TestFramework;
using NUnit.Framework;

namespace Azure.Communication.Chat.Tests.samples
{
public partial class Sample4_KeyConcepts : ChatSampleBase
public partial class Sample4_KeyConcepts : SamplesBase<ChatTestEnvironment>
{
// This sample demonstrates the operations that can be performed on a thread: create, get, getThreads, update and delete.
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ public class CommunicationTestEnvironment : TestEnvironment
public const string LiveTestDynamicConnectionStringEnvironmentVariableName = "COMMUNICATION_LIVETEST_DYNAMIC_CONNECTION_STRING";
public const string LiveTestStaticConnectionStringEnvironmentVariableName = "COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING";
public const string AzurePhoneNumber = "AZURE_PHONE_NUMBER";
protected const string TestPackagesEnabledDefaultValue = "all";
private const string TestPackagesEnabledEnvironmentVariableName = "TEST_PACKAGES_ENABLED";
private const string SkipIntSmsTestEnvironmentVariableName = "SKIP_INT_SMS_TEST";
private const string SkipIntPhoneNumbersTestEnvironmentVariableName = "SKIP_INT_PHONENUMBERS_TEST";

Expand All @@ -34,21 +32,8 @@ public class CommunicationTestEnvironment : TestEnvironment

public string SkipPhoneNumbersTest => GetOptionalVariable(SkipIntPhoneNumbersTestEnvironmentVariableName) ?? "False";

public virtual string ExpectedTestPackagesEnabled { get { return TestPackagesEnabledDefaultValue; } }
public bool ShouldIgnoreSMSTests => bool.Parse(SkipSmsTest);

public bool ShouldIgnoreTests => TestPackagesEnabled != TestPackagesEnabledDefaultValue
&& TestPackagesEnabled != ExpectedTestPackagesEnabled;

public bool ShouldIgnoreSMSTests => ShouldIgnoreTests || bool.Parse(SkipSmsTest);

public bool ShouldIgnorePhoneNumbersTests => ShouldIgnoreTests || bool.Parse(SkipPhoneNumbersTest);

public string TestPackagesEnabled => GetTestPackageEnabled();

private string GetTestPackageEnabled()
{
string? package = Environment.GetEnvironmentVariable(TestPackagesEnabledEnvironmentVariableName);
return package ?? TestPackagesEnabledDefaultValue;
}
public bool ShouldIgnorePhoneNumbersTests => bool.Parse(SkipPhoneNumbersTest);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Azure.Communication.Pipeline;
using Azure.Core.TestFramework;
using Azure.Identity;
using NUnit.Framework;

namespace Azure.Communication.Identity.Tests
{
Expand All @@ -13,16 +12,6 @@ public class CommunicationIdentityClientLiveTestBase : RecordedTestBase<Communic
public CommunicationIdentityClientLiveTestBase(bool isAsync) : base(isAsync)
=> Sanitizer = new CommunicationIdentityClientRecordedTestSanitizer();

[OneTimeSetUp]
public void Setup()
{
if (TestEnvironment.ShouldIgnoreTests)
{
Assert.Ignore("Identity tests are skipped " +
"because identity package is not included in the TEST_PACKAGES_ENABLED variable");
}
}

/// <summary>
/// Creates a <see cref="CommunicationIdentityClient" /> with the connectionstring via environment
/// variables and instruments it to make use of the Azure Core Test Framework functionalities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@ namespace Azure.Communication.Identity.Tests
{
public class CommunicationIdentityClientTestEnvironment : CommunicationTestEnvironment
{
// please find the allowed package value in tests.yml
private const string IdentityTestPackagesEnabled = "identity";
public override string ExpectedTestPackagesEnabled { get { return IdentityTestPackagesEnabled; } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Azure.Communication.Tests;
using Azure.Core.TestFramework;
using Azure.Identity;
using NUnit.Framework;

namespace Azure.Communication.PhoneNumbers.Tests
{
Expand All @@ -19,16 +18,6 @@ public PhoneNumbersClientLiveTestBase(bool isAsync) : base(isAsync)
public bool SkipPhoneNumberLiveTests
=> TestEnvironment.Mode != RecordedTestMode.Playback && Environment.GetEnvironmentVariable("SKIP_PHONENUMBER_LIVE_TESTS") == "TRUE";

[OneTimeSetUp]
public void Setup()
{
if (TestEnvironment.ShouldIgnoreTests)
{
Assert.Ignore("Phone number tests are skipped " +
"because phonenumbers package is not included in the TEST_PACKAGES_ENABLED variable");
}
}

/// <summary>
/// Creates a <see cref="PhoneNumbersClient" /> with the connectionstring via environment
/// variables and instruments it to make use of the Azure Core Test Framework functionalities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ namespace Azure.Communication.PhoneNumbers.Tests
{
public class PhoneNumbersClientTestEnvironment : CommunicationTestEnvironment
{
// please find the allowed package value in tests.yml
private const string PhoneNumberTestPackagesEnabled = "phonenumber";
public override string ExpectedTestPackagesEnabled { get { return PhoneNumberTestPackagesEnabled; } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ public class SmsClientLiveTestBase : RecordedTestBase<SmsClientTestEnvironment>
public SmsClientLiveTestBase(bool isAsync) : base(isAsync)
=> Sanitizer = new SmsClientRecordedTestSanitizer();

[OneTimeSetUp]
public void Setup()
{
if (TestEnvironment.ShouldIgnoreSMSTests)
{
Assert.Ignore("SMS tests are skipped " +
"because sms package is not included in the TEST_PACKAGES_ENABLED variable");
}
}

public SmsClient CreateSmsClient()
{
var connectionString = TestEnvironment.LiveTestStaticConnectionString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ namespace Azure.Communication.Sms.Tests
{
public class SmsClientTestEnvironment : CommunicationTestEnvironment
{
// please find the allowed package value in tests.yml
private const string SmsTestPackagesEnabled = "sms";

public override string ExpectedTestPackagesEnabled { get { return SmsTestPackagesEnabled; } }

public string ToPhoneNumber => GetRecordedVariable(AzurePhoneNumber);

public string FromPhoneNumber => GetRecordedVariable(AzurePhoneNumber);
Expand Down
32 changes: 0 additions & 32 deletions sdk/communication/tests.yml

This file was deleted.