Chore: Rename Id to ID in alerting models (#62777)
* Chore: Rename Id to ID in alerting models * Add xorm tags for datasource * Add xorm tag for uid
This commit is contained in:
@@ -121,7 +121,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
jd, err := ds.JsonData.Map()
|
||||
require.NoError(t, err)
|
||||
dsInfo := DSInfo{
|
||||
ID: ds.Id,
|
||||
ID: ds.ID,
|
||||
Updated: ds.Updated,
|
||||
JSONData: jd,
|
||||
DecryptedSecureJSONData: map[string]string{
|
||||
@@ -307,7 +307,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
jd, err := ds.JsonData.Map()
|
||||
require.NoError(t, err)
|
||||
dsInfo := DSInfo{
|
||||
ID: ds.Id,
|
||||
ID: ds.ID,
|
||||
Updated: ds.Updated,
|
||||
JSONData: jd,
|
||||
DecryptedSecureJSONData: map[string]string{
|
||||
@@ -372,7 +372,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
|
||||
t.Run("When proxying graphite", func(t *testing.T) {
|
||||
var routes []*plugins.Route
|
||||
ds := &datasources.DataSource{Url: "htttp://graphite:8080", Type: datasources.DS_GRAPHITE}
|
||||
ds := &datasources.DataSource{URL: "htttp://graphite:8080", Type: datasources.DS_GRAPHITE}
|
||||
ctx := &contextmodel.ReqContext{}
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
@@ -397,7 +397,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
t.Run("When proxying InfluxDB", func(t *testing.T) {
|
||||
ds := &datasources.DataSource{
|
||||
Type: datasources.DS_INFLUXDB_08,
|
||||
Url: "http://influxdb:8083",
|
||||
URL: "http://influxdb:8083",
|
||||
Database: "site",
|
||||
User: "user",
|
||||
}
|
||||
@@ -426,7 +426,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
|
||||
ds := &datasources.DataSource{
|
||||
Type: datasources.DS_GRAPHITE,
|
||||
Url: "http://graphite:8086",
|
||||
URL: "http://graphite:8086",
|
||||
JsonData: json,
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
|
||||
ds := &datasources.DataSource{
|
||||
Type: datasources.DS_GRAPHITE,
|
||||
Url: "http://graphite:8086",
|
||||
URL: "http://graphite:8086",
|
||||
JsonData: json,
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
t.Run("When proxying a custom datasource", func(t *testing.T) {
|
||||
ds := &datasources.DataSource{
|
||||
Type: "custom-datasource",
|
||||
Url: "http://host/root/",
|
||||
URL: "http://host/root/",
|
||||
}
|
||||
ctx := &contextmodel.ReqContext{}
|
||||
var routes []*plugins.Route
|
||||
@@ -515,7 +515,7 @@ func TestDataSourceProxy_routeRule(t *testing.T) {
|
||||
t.Run("When proxying a datasource that has OAuth token pass-through enabled", func(t *testing.T) {
|
||||
ds := &datasources.DataSource{
|
||||
Type: "custom-datasource",
|
||||
Url: "http://host/root/",
|
||||
URL: "http://host/root/",
|
||||
JsonData: simplejson.NewFromAny(map[string]interface{}{
|
||||
"oauthPassThru": true,
|
||||
}),
|
||||
@@ -657,7 +657,7 @@ func TestDataSourceProxy_requestHandling(t *testing.T) {
|
||||
}))
|
||||
t.Cleanup(backend.Close)
|
||||
|
||||
ds := &datasources.DataSource{Url: backend.URL, Type: datasources.DS_GRAPHITE}
|
||||
ds := &datasources.DataSource{URL: backend.URL, Type: datasources.DS_GRAPHITE}
|
||||
|
||||
responseWriter := web.NewResponseWriter("GET", httptest.NewRecorder())
|
||||
|
||||
@@ -829,7 +829,7 @@ func TestNewDataSourceProxy_InvalidURL(t *testing.T) {
|
||||
}
|
||||
ds := datasources.DataSource{
|
||||
Type: "test",
|
||||
Url: "://host/root",
|
||||
URL: "://host/root",
|
||||
}
|
||||
cfg := &setting.Cfg{}
|
||||
tracer := tracing.InitializeTracerForTest()
|
||||
@@ -853,7 +853,7 @@ func TestNewDataSourceProxy_ProtocolLessURL(t *testing.T) {
|
||||
}
|
||||
ds := datasources.DataSource{
|
||||
Type: "test",
|
||||
Url: "127.0.01:5432",
|
||||
URL: "127.0.01:5432",
|
||||
}
|
||||
cfg := &setting.Cfg{}
|
||||
tracer := tracing.InitializeTracerForTest()
|
||||
@@ -901,7 +901,7 @@ func TestNewDataSourceProxy_MSSQL(t *testing.T) {
|
||||
cfg := &setting.Cfg{}
|
||||
ds := datasources.DataSource{
|
||||
Type: "mssql",
|
||||
Url: tc.url,
|
||||
URL: tc.url,
|
||||
}
|
||||
|
||||
var routes []*plugins.Route
|
||||
@@ -916,7 +916,7 @@ func TestNewDataSourceProxy_MSSQL(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, &url.URL{
|
||||
Scheme: "sqlserver",
|
||||
Host: ds.Url,
|
||||
Host: ds.URL,
|
||||
}, p.targetUrl)
|
||||
} else {
|
||||
require.Error(t, err)
|
||||
@@ -930,7 +930,7 @@ func TestNewDataSourceProxy_MSSQL(t *testing.T) {
|
||||
func getDatasourceProxiedRequest(t *testing.T, ctx *contextmodel.ReqContext, cfg *setting.Cfg) *http.Request {
|
||||
ds := &datasources.DataSource{
|
||||
Type: "custom",
|
||||
Url: "http://host/root/",
|
||||
URL: "http://host/root/",
|
||||
}
|
||||
tracer := tracing.InitializeTracerForTest()
|
||||
|
||||
@@ -999,12 +999,12 @@ func createAuthTest(t *testing.T, secretsStore secretskvs.SecretsKVStore, dsType
|
||||
|
||||
test := &testCase{
|
||||
datasource: &datasources.DataSource{
|
||||
Id: 1,
|
||||
OrgId: 1,
|
||||
ID: 1,
|
||||
OrgID: 1,
|
||||
Name: fmt.Sprintf("%s,%s,%s,%s", dsType, url, authType, authCheck),
|
||||
Type: dsType,
|
||||
JsonData: simplejson.New(),
|
||||
Url: url,
|
||||
URL: url,
|
||||
},
|
||||
}
|
||||
var message string
|
||||
@@ -1017,7 +1017,7 @@ func createAuthTest(t *testing.T, secretsStore secretskvs.SecretsKVStore, dsType
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
err = secretsStore.Set(context.Background(), test.datasource.OrgId, test.datasource.Name, "datasource", string(secureJsonData))
|
||||
err = secretsStore.Set(context.Background(), test.datasource.OrgID, test.datasource.Name, "datasource", string(secureJsonData))
|
||||
require.NoError(t, err)
|
||||
} else {
|
||||
message = fmt.Sprintf("%v should add basic auth username and password", dsType)
|
||||
@@ -1028,7 +1028,7 @@ func createAuthTest(t *testing.T, secretsStore secretskvs.SecretsKVStore, dsType
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
err = secretsStore.Set(context.Background(), test.datasource.OrgId, test.datasource.Name, "datasource", string(secureJsonData))
|
||||
err = secretsStore.Set(context.Background(), test.datasource.OrgID, test.datasource.Name, "datasource", string(secureJsonData))
|
||||
require.NoError(t, err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user