-
Notifications
You must be signed in to change notification settings - Fork 502
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for AAD connection strings
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,14 @@ func TestInvalidConnectionString(t *testing.T) { | |
"failoverport=invalid", | ||
"applicationintent=ReadOnly", | ||
|
||
// AAD | ||
"fedauth=ActiveDirectoryApplication;user id=clientidwithouttenantid;clientcertpath=/secrets/spn.pem", | ||
"fedauth=UnknownType", | ||
// encryption cannot be disabled for AAD | ||
"encrypt=DISABLE;fedauth=ActiveDirectoryPassword;user [email protected];password=secret", | ||
"encrypt=DISABLE;fedauth=ActiveDirectoryMSI", | ||
"encrypt=DISABLE;fedauth=ActiveDirectoryApplication;user id=clientid@tenantid;clientcertpath=/secrets/spn.pem", | ||
|
||
// ODBC mode | ||
"odbc:password={", | ||
"odbc:password={somepass", | ||
|
@@ -74,6 +82,17 @@ func TestValidConnectionString(t *testing.T) { | |
{"log=64;packet size=8192", func(p connectParams) bool { return p.logFlags == 64 && p.packetSize == 8192 }}, | ||
{"log=64;packet size=48000", func(p connectParams) bool { return p.logFlags == 64 && p.packetSize == 32767 }}, | ||
|
||
// AAD | ||
{"fedauth=ActiveDirectoryPassword;user [email protected];password=secret", func(p connectParams) bool { | ||
return p.fedAuthLibrary == fedAuthLibraryADAL && p.fedAuthADALWorkflow == fedAuthADALWorkflowPassword | ||
}}, | ||
{"fedauth=ActiveDirectoryMSI", func(p connectParams) bool { | ||
return p.fedAuthLibrary == fedAuthLibraryADAL && p.fedAuthADALWorkflow == fedAuthADALWorkflowMSI | ||
}}, | ||
{"fedauth=ActiveDirectoryApplication;user id=clientid@tenantid;clientcertpath=/secrets/spn.pem", func(p connectParams) bool { | ||
return p.fedAuthLibrary == fedAuthLibrarySecurityToken && p.user == "clientid" && p.aadTenantID == "tenantid" && p.aadClientCertPath == "/secrets/spn.pem" | ||
}}, | ||
|
||
// those are supported currently, but maybe should not be | ||
{"someparam", func(p connectParams) bool { return true }}, | ||
{";;=;", func(p connectParams) bool { return true }}, | ||
|