mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 11:12:58 +08:00
MSSQL: Change regex to validate Provider connection string (#40248)
* Change the regex to allow to specified other connection attribute for MSSQL connection like ApplicationIntent property * Docs update * docs update * some tests added * formatting * Change the regex to allow to specified other connection attribute for MSSQL connection like ApplicationIntent property * Docs update * docs update * some tests added * formatting * docs and formatting Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
This commit is contained in:
@ -1331,6 +1331,86 @@ func TestGenerateConnectionString(t *testing.T) {
|
||||
},
|
||||
expConnStr: "server=localhost;database=database;user id=user;password=;",
|
||||
},
|
||||
{
|
||||
desc: "With instance name",
|
||||
dataSource: sqleng.DataSourceInfo{
|
||||
URL: "localhost\\instance",
|
||||
Database: "database",
|
||||
User: "user",
|
||||
JsonData: sqleng.JsonData{},
|
||||
},
|
||||
expConnStr: "server=localhost\\instance;database=database;user id=user;password=;",
|
||||
},
|
||||
{
|
||||
desc: "With instance name and port",
|
||||
dataSource: sqleng.DataSourceInfo{
|
||||
URL: "localhost\\instance:333",
|
||||
Database: "database",
|
||||
User: "user",
|
||||
JsonData: sqleng.JsonData{},
|
||||
},
|
||||
expConnStr: "server=localhost\\instance;database=database;user id=user;password=;port=333;",
|
||||
},
|
||||
{
|
||||
desc: "With instance name and ApplicationIntent",
|
||||
dataSource: sqleng.DataSourceInfo{
|
||||
URL: "localhost\\instance;ApplicationIntent=ReadOnly",
|
||||
Database: "database",
|
||||
User: "user",
|
||||
JsonData: sqleng.JsonData{},
|
||||
},
|
||||
expConnStr: "server=localhost\\instance;ApplicationIntent=ReadOnly;database=database;user id=user;password=;",
|
||||
},
|
||||
{
|
||||
desc: "With ApplicationIntent instance name and port",
|
||||
dataSource: sqleng.DataSourceInfo{
|
||||
URL: "localhost\\instance:333;ApplicationIntent=ReadOnly",
|
||||
Database: "database",
|
||||
User: "user",
|
||||
JsonData: sqleng.JsonData{},
|
||||
},
|
||||
expConnStr: "server=localhost\\instance;database=database;user id=user;password=;port=333;ApplicationIntent=ReadOnly;",
|
||||
},
|
||||
{
|
||||
desc: "With instance name",
|
||||
dataSource: sqleng.DataSourceInfo{
|
||||
URL: "localhost\\instance",
|
||||
Database: "database",
|
||||
User: "user",
|
||||
JsonData: sqleng.JsonData{},
|
||||
},
|
||||
expConnStr: "server=localhost\\instance;database=database;user id=user;password=;",
|
||||
},
|
||||
{
|
||||
desc: "With instance name and port",
|
||||
dataSource: sqleng.DataSourceInfo{
|
||||
URL: "localhost\\instance:333",
|
||||
Database: "database",
|
||||
User: "user",
|
||||
JsonData: sqleng.JsonData{},
|
||||
},
|
||||
expConnStr: "server=localhost\\instance;database=database;user id=user;password=;port=333;",
|
||||
},
|
||||
{
|
||||
desc: "With instance name and ApplicationIntent",
|
||||
dataSource: sqleng.DataSourceInfo{
|
||||
URL: "localhost\\instance;ApplicationIntent=ReadOnly",
|
||||
Database: "database",
|
||||
User: "user",
|
||||
JsonData: sqleng.JsonData{},
|
||||
},
|
||||
expConnStr: "server=localhost\\instance;ApplicationIntent=ReadOnly;database=database;user id=user;password=;",
|
||||
},
|
||||
{
|
||||
desc: "With ApplicationIntent instance name and port",
|
||||
dataSource: sqleng.DataSourceInfo{
|
||||
URL: "localhost\\instance:333;ApplicationIntent=ReadOnly",
|
||||
Database: "database",
|
||||
User: "user",
|
||||
JsonData: sqleng.JsonData{},
|
||||
},
|
||||
expConnStr: "server=localhost\\instance;database=database;user id=user;password=;port=333;ApplicationIntent=ReadOnly;",
|
||||
},
|
||||
{
|
||||
desc: "Defaults",
|
||||
dataSource: sqleng.DataSourceInfo{
|
||||
|
Reference in New Issue
Block a user