From d090602eae7fb3bd4cf20348f289431b96797ea7 Mon Sep 17 00:00:00 2001 From: Apoorv Deshmukh Date: Thu, 31 Aug 2023 21:12:28 +0530 Subject: [PATCH] Use testify for asserts --- azuread/azuread_test.go | 11 +++-------- msdsn/conn_str_test.go | 3 +++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/azuread/azuread_test.go b/azuread/azuread_test.go index 75590305..0b5a42e0 100644 --- a/azuread/azuread_test.go +++ b/azuread/azuread_test.go @@ -12,6 +12,7 @@ import ( "testing" mssql "github.com/microsoft/go-mssqldb" + "github.com/stretchr/testify/assert" ) func TestAzureSqlAuth(t *testing.T) { @@ -54,8 +55,8 @@ func TestTDS8ConnWithAzureSqlAuth(t *testing.T) { if err != nil { t.Fatal("Scan failed:", err.Error()) } - assertEqual(t, "TSQL", protocolName) - assertEqual(t, "0x08000000", hex.EncodeToString(tdsver)) + assert.Equal(t, "TSQL", protocolName, "Protocol name does not match") + assert.Equal(t, "0x08000000", hex.EncodeToString(tdsver)) } // returns parsed connection parameters derived from @@ -87,9 +88,3 @@ func testConnParams(t testing.TB, dsnParams string) *azureFedAuthConfig { config.mssqlConfig.LogFlags = logFlags return config } - -func assertEqual(t *testing.T, expected interface{}, actual interface{}) { - if expected != actual { - t.Fatalf("Expected %v, got %v", expected, actual) - } -} diff --git a/msdsn/conn_str_test.go b/msdsn/conn_str_test.go index 329caf8f..3aab7dd1 100644 --- a/msdsn/conn_str_test.go +++ b/msdsn/conn_str_test.go @@ -75,6 +75,9 @@ func TestValidConnectionString(t *testing.T) { {"encrypt=true;tlsmin=1.2", func(p Config) bool { return p.Encryption == EncryptionRequired && p.TLSConfig.MinVersion == tls.VersionTLS12 }}, + {"encrypt=true;tlsmin=1.3", func(p Config) bool { + return p.Encryption == EncryptionRequired && p.TLSConfig.MinVersion == tls.VersionTLS13 + }}, {"encrypt=true;tlsmin=1.4", func(p Config) bool { return p.Encryption == EncryptionRequired && p.TLSConfig.MinVersion == 0 }},