From 6c2d5668f410d5cd05324c79119d9354fdc8f9da Mon Sep 17 00:00:00 2001 From: Scott Schaab Date: Thu, 29 Jul 2021 16:16:56 -0700 Subject: [PATCH 1/8] Workaround fix for nigthly test failure in VSCC --- sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs b/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs index 7961d9bf931db..870388a9b351c 100644 --- a/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs +++ b/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs @@ -142,7 +142,6 @@ public static async Task GetRefreshTokenAsync(IdentityTestEnvironment te var client = PublicClientApplicationBuilder.Create(clientId) .WithAuthority(authorityUri) - .WithTenantId(testEnvironment.TestTenantId) .Build(); var retriever = new RefreshTokenRetriever(client.UserTokenCache); From 4c14e096b9377ffc23771c6f903ae2d4f9faaa61 Mon Sep 17 00:00:00 2001 From: Scott Schaab Date: Fri, 30 Jul 2021 14:19:56 -0700 Subject: [PATCH 2/8] Enable VSCC test logging to diagnose pipeline --- .../tests/VisualStudioCodeCredentialLiveTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs b/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs index a2b4d523e6e6d..d5438153a585a 100644 --- a/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs +++ b/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs @@ -2,23 +2,39 @@ // Licensed under the MIT License. using System; +using System.Diagnostics.Tracing; using System.IO; using System.Threading; using System.Threading.Tasks; using Azure.Core; +using Azure.Core.Diagnostics; using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Identity.Tests { + [NonParallelizable] public class VisualStudioCodeCredentialLiveTests : IdentityRecordedTestBase { private const string ExpectedServiceName = "VS Code Azure"; + private AzureEventSourceListener _logListener; public VisualStudioCodeCredentialLiveTests(bool isAsync) : base(isAsync) { } + [SetUp] + public void EnableLogging() + { + _logListener = new AzureEventSourceListener((_, message) => TestContext.WriteLine(message), EventLevel.Verbose); + } + + [TearDown] + public void DisableLogging() + { + _logListener.Dispose(); + } + [Test] [RunOnlyOnPlatforms(Windows = true, OSX = true, ContainerNames = new[] { "ubuntu_netcore_keyring" })] public async Task AuthenticateWithVscCredential() From 5fb42546fbb514d142e35deb1507ac3a00599b53 Mon Sep 17 00:00:00 2001 From: Scott Schaab Date: Fri, 30 Jul 2021 14:36:01 -0700 Subject: [PATCH 3/8] wip --- sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs b/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs index 870388a9b351c..7961d9bf931db 100644 --- a/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs +++ b/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs @@ -142,6 +142,7 @@ public static async Task GetRefreshTokenAsync(IdentityTestEnvironment te var client = PublicClientApplicationBuilder.Create(clientId) .WithAuthority(authorityUri) + .WithTenantId(testEnvironment.TestTenantId) .Build(); var retriever = new RefreshTokenRetriever(client.UserTokenCache); From 06d5c9b00c67910d2267bb5ab496d0f536dd8707 Mon Sep 17 00:00:00 2001 From: Scott Schaab Date: Fri, 30 Jul 2021 15:59:46 -0700 Subject: [PATCH 4/8] logging to console --- .../Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs b/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs index d5438153a585a..735b341d0fb3c 100644 --- a/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs +++ b/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs @@ -26,7 +26,7 @@ public VisualStudioCodeCredentialLiveTests(bool isAsync) : base(isAsync) [SetUp] public void EnableLogging() { - _logListener = new AzureEventSourceListener((_, message) => TestContext.WriteLine(message), EventLevel.Verbose); + _logListener = new AzureEventSourceListener((_, message) => Console.WriteLine(message), EventLevel.Verbose); } [TearDown] From ddd75927edab4aecf51a452bdbdf9f23831b6dbc Mon Sep 17 00:00:00 2001 From: Scott Schaab Date: Fri, 30 Jul 2021 17:08:17 -0700 Subject: [PATCH 5/8] adding temp fix for log collection --- sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs b/sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs index a8b52fc4e2333..23e1a7a388aab 100644 --- a/sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs +++ b/sdk/core/Azure.Core.TestFramework/src/RecordedTestBase.cs @@ -9,6 +9,7 @@ using Castle.DynamicProxy; using NUnit.Framework; using NUnit.Framework.Interfaces; +using NUnit.Framework.Internal; namespace Azure.Core.TestFramework { @@ -153,6 +154,13 @@ public virtual void StartTestRecording() [TearDown] public virtual void StopTestRecording() { + if (TestEnvironment.GlobalIsRunningInCI) + { + var tempFileName = Path.GetTempFileName(); + File.WriteAllText(tempFileName, TestExecutionContext.CurrentContext.CurrentResult.Output); + TestContext.AddTestAttachment(tempFileName, "Test Output"); + } + bool testPassed = TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Passed; if (ValidateClientInstrumentation && testPassed) From 72dbfd26c20f215c74b29366e993ffce8b9d0e1b Mon Sep 17 00:00:00 2001 From: Scott Schaab Date: Sat, 31 Jul 2021 11:34:58 -0700 Subject: [PATCH 6/8] back to TestContext --- .../Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs b/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs index 735b341d0fb3c..d5438153a585a 100644 --- a/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs +++ b/sdk/identity/Azure.Identity/tests/VisualStudioCodeCredentialLiveTests.cs @@ -26,7 +26,7 @@ public VisualStudioCodeCredentialLiveTests(bool isAsync) : base(isAsync) [SetUp] public void EnableLogging() { - _logListener = new AzureEventSourceListener((_, message) => Console.WriteLine(message), EventLevel.Verbose); + _logListener = new AzureEventSourceListener((_, message) => TestContext.WriteLine(message), EventLevel.Verbose); } [TearDown] From f01d0c0e5971b312754b521e0dae15e18eacb069 Mon Sep 17 00:00:00 2001 From: Scott Schaab Date: Mon, 2 Aug 2021 14:29:49 -0700 Subject: [PATCH 7/8] try scope used by UPC tests --- sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs b/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs index 7961d9bf931db..f3ee2e97fdb8f 100644 --- a/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs +++ b/sdk/identity/Azure.Identity/tests/CredentialTestHelpers.cs @@ -146,7 +146,7 @@ public static async Task GetRefreshTokenAsync(IdentityTestEnvironment te .Build(); var retriever = new RefreshTokenRetriever(client.UserTokenCache); - await client.AcquireTokenByUsernamePassword(new[] { ".default" }, username, password.ToSecureString()).ExecuteAsync(); + await client.AcquireTokenByUsernamePassword(new[] { "https://vault.azure.net/.default" }, username, password.ToSecureString()).ExecuteAsync(); StaticCachesUtilities.ClearStaticMetadataProviderCache(); StaticCachesUtilities.ClearAuthorityEndpointResolutionManagerCache(); From 00fce055c6d02fc99e2c4edb71dc0fb923dbe71e Mon Sep 17 00:00:00 2001 From: Scott Schaab Date: Mon, 9 Aug 2021 13:06:20 -0700 Subject: [PATCH 8/8] modifying live test pipeline to only run VSCC tests --- eng/pipelines/templates/jobs/live.tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/live.tests.yml b/eng/pipelines/templates/jobs/live.tests.yml index a75d58bdf5903..108b8ae8281a4 100644 --- a/eng/pipelines/templates/jobs/live.tests.yml +++ b/eng/pipelines/templates/jobs/live.tests.yml @@ -110,7 +110,7 @@ jobs: - pwsh: > dotnet test eng/service.proj --framework $(TestTargetFramework) - --filter "TestCategory!=Manually" + --filter "(TestCategory!=Manually)&(FullyQualifiedName~Azure.Identity.Tests.VisualStudioCodeCredentialLiveTests)" --logger "trx" --logger:"console;verbosity=normal" /p:SDKType=${{ parameters.SDKType }}