From 52a6f317d2e10770011f776e9570ee0041cb83df Mon Sep 17 00:00:00 2001 From: Cheena Malhotra Date: Tue, 20 Oct 2020 19:16:19 -0700 Subject: [PATCH] Upgrade MSAL library version Also removed tests that compared error messages not owned by SqlClient. --- .../ConnectivityTests/AADConnectionTest.cs | 27 ++++--------------- tools/props/Versions.props | 2 +- tools/specs/Microsoft.Data.SqlClient.nuspec | 10 +++---- 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs index 2e58b0df04..e8396b0b4c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectivityTests/AADConnectionTest.cs @@ -211,10 +211,7 @@ public static void ActiveDirectoryPasswordWithNoAuthType() // connection fails with expected error message. string[] AuthKey = { "Authentication" }; string connStrWithNoAuthType = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, AuthKey); - SqlException e = Assert.Throws(() => ConnectAndDisconnect(connStrWithNoAuthType)); - - string expectedMessage = "Cannot open server \"microsoft.com\" requested by the login. The login failed."; - Assert.Contains(expectedMessage, e.Message); + Assert.Throws(() => ConnectAndDisconnect(connStrWithNoAuthType)); } [ConditionalFact(nameof(IsAADConnStringsSetup))] @@ -248,10 +245,7 @@ public static void EmptyPasswordInConnStrAADPassword() // connection fails with expected error message. string[] pwdKey = { "Password", "PWD" }; string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, pwdKey) + "Password=;"; - AggregateException e = Assert.Throws(() => ConnectAndDisconnect(connStr)); - - string expectedMessage = "ID3242: The security token could not be authenticated or authorized."; - Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message); + Assert.Throws(() => ConnectAndDisconnect(connStr)); } [PlatformSpecific(TestPlatforms.Windows)] @@ -261,11 +255,7 @@ public static void EmptyCredInConnStrAADPassword() // connection fails with expected error message. string[] removeKeys = { "User ID", "Password", "UID", "PWD" }; string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, removeKeys) + "User ID=; Password=;"; - AggregateException e = Assert.Throws(() => ConnectAndDisconnect(connStr)); - - string expectedMessage = "Failed to get user name"; - - Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message); + Assert.Throws(() => ConnectAndDisconnect(connStr)); } [PlatformSpecific(TestPlatforms.AnyUnix)] @@ -275,11 +265,7 @@ public static void EmptyCredInConnStrAADPasswordAnyUnix() // connection fails with expected error message. string[] removeKeys = { "User ID", "Password", "UID", "PWD" }; string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, removeKeys) + "User ID=; Password=;"; - AggregateException e = Assert.Throws(() => ConnectAndDisconnect(connStr)); - - string expectedMessage = "cannot determine the username"; - - Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message); + Assert.Throws(() => ConnectAndDisconnect(connStr)); } [ConditionalFact(nameof(IsAADConnStringsSetup))] @@ -288,10 +274,7 @@ public static void AADPasswordWithInvalidUser() // connection fails with expected error message. string[] removeKeys = { "User ID", "UID" }; string connStr = DataTestUtility.RemoveKeysInConnStr(DataTestUtility.AADPasswordConnectionString, removeKeys) + "User ID=testdotnet@microsoft.com"; - AggregateException e = Assert.Throws(() => ConnectAndDisconnect(connStr)); - - string expectedMessage = "ID3242: The security token could not be authenticated or authorized."; - Assert.Contains(expectedMessage, e.InnerException.InnerException.InnerException.Message); + Assert.Throws(() => ConnectAndDisconnect(connStr)); } [ConditionalFact(nameof(IsAADConnStringsSetup))] diff --git a/tools/props/Versions.props b/tools/props/Versions.props index 044d79f9d2..15329f632c 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -18,7 +18,7 @@ - 4.14.0 + 4.21.1 5.6.0 5.6.0 4.5.1 diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec index 1637214a69..944e2d6143 100644 --- a/tools/specs/Microsoft.Data.SqlClient.nuspec +++ b/tools/specs/Microsoft.Data.SqlClient.nuspec @@ -28,7 +28,7 @@ When using NuGet 3.x this package requires at least version 3.4. - + @@ -40,7 +40,7 @@ When using NuGet 3.x this package requires at least version 3.4. - + @@ -52,7 +52,7 @@ When using NuGet 3.x this package requires at least version 3.4. - + @@ -63,7 +63,7 @@ When using NuGet 3.x this package requires at least version 3.4. - + @@ -74,7 +74,7 @@ When using NuGet 3.x this package requires at least version 3.4. - +