Expressions: Fixes the issue showing expressions editor (#62510)
* Use suggested value for uid * update the snapshot * use __expr__ * replace all -100 with __expr__ * update snapshot * more changes * revert redundant change * Use expr.DatasourceUID where it's possible * generate files
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/expr"
|
||||
"github.com/prometheus/common/model"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -508,7 +509,7 @@ func TestIntegrationAlertAndGroupsQuery(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -649,7 +650,7 @@ func TestIntegrationRulerAccess(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -752,7 +753,7 @@ func TestIntegrationDeleteFolderWithRules(t *testing.T) {
|
||||
"from": 18000,
|
||||
"to": 10800
|
||||
},
|
||||
"datasourceUid": "-100",
|
||||
"datasourceUid": "__expr__",
|
||||
"model": {
|
||||
"expression": "2 + 3 > 1",
|
||||
"intervalMs": 1000,
|
||||
@@ -907,7 +908,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -937,7 +938,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -967,7 +968,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -998,7 +999,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -1058,7 +1059,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -1117,7 +1118,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -1137,7 +1138,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -1208,7 +1209,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
"from":18000,
|
||||
"to":10800
|
||||
},
|
||||
"datasourceUid":"-100",
|
||||
"datasourceUid":"__expr__",
|
||||
"model":{
|
||||
"expression":"2 + 3 \u003e 1",
|
||||
"intervalMs":1000,
|
||||
@@ -1244,7 +1245,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
"from":18000,
|
||||
"to":10800
|
||||
},
|
||||
"datasourceUid":"-100",
|
||||
"datasourceUid":"__expr__",
|
||||
"model":{
|
||||
"expression":"2 + 3 \u003e 1",
|
||||
"intervalMs":1000,
|
||||
@@ -1302,7 +1303,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 < 1"
|
||||
@@ -1375,7 +1376,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 < 1"
|
||||
@@ -1409,7 +1410,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -1483,7 +1484,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 < 1"
|
||||
@@ -1551,7 +1552,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
"from":18000,
|
||||
"to":10800
|
||||
},
|
||||
"datasourceUid":"-100",
|
||||
"datasourceUid":"__expr__",
|
||||
"model":{
|
||||
"expression":"2 + 3 \u003C 1",
|
||||
"intervalMs":1000,
|
||||
@@ -1600,7 +1601,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 < 1"
|
||||
@@ -1660,7 +1661,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
"from":18000,
|
||||
"to":10800
|
||||
},
|
||||
"datasourceUid":"-100",
|
||||
"datasourceUid":"__expr__",
|
||||
"model":{
|
||||
"expression":"2 + 3 \u003C 1",
|
||||
"intervalMs":1000,
|
||||
@@ -1745,7 +1746,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
|
||||
"from":18000,
|
||||
"to":10800
|
||||
},
|
||||
"datasourceUid":"-100",
|
||||
"datasourceUid":"__expr__",
|
||||
"model":{
|
||||
"expression":"2 + 3 \u003C 1",
|
||||
"intervalMs":1000,
|
||||
@@ -1957,7 +1958,7 @@ func TestIntegrationQuota(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 3 > 1"
|
||||
@@ -1992,7 +1993,7 @@ func TestIntegrationQuota(t *testing.T) {
|
||||
From: ngmodels.Duration(time.Duration(5) * time.Hour),
|
||||
To: ngmodels.Duration(time.Duration(3) * time.Hour),
|
||||
},
|
||||
DatasourceUID: "-100",
|
||||
DatasourceUID: expr.DatasourceUID,
|
||||
Model: json.RawMessage(`{
|
||||
"type": "math",
|
||||
"expression": "2 + 4 > 1"
|
||||
@@ -2051,7 +2052,7 @@ func TestIntegrationQuota(t *testing.T) {
|
||||
"from":18000,
|
||||
"to":10800
|
||||
},
|
||||
"datasourceUid":"-100",
|
||||
"datasourceUid":"__expr__",
|
||||
"model":{
|
||||
"expression":"2 + 4 \u003E 1",
|
||||
"intervalMs":1000,
|
||||
@@ -2122,7 +2123,7 @@ func TestIntegrationEval(t *testing.T) {
|
||||
"from": 18000,
|
||||
"to": 10800
|
||||
},
|
||||
"datasourceUid":"-100",
|
||||
"datasourceUid":"__expr__",
|
||||
"model": {
|
||||
"type":"math",
|
||||
"expression":"1 < 2"
|
||||
@@ -2186,7 +2187,7 @@ func TestIntegrationEval(t *testing.T) {
|
||||
"from": 18000,
|
||||
"to": 10800
|
||||
},
|
||||
"datasourceUid": "-100",
|
||||
"datasourceUid": "__expr__",
|
||||
"model": {
|
||||
"type":"math",
|
||||
"expression":"1 > 2"
|
||||
@@ -2250,7 +2251,7 @@ func TestIntegrationEval(t *testing.T) {
|
||||
"from": 18000,
|
||||
"to": 10800
|
||||
},
|
||||
"datasourceUid": "-100",
|
||||
"datasourceUid": "__expr__",
|
||||
"model": {
|
||||
"type":"math",
|
||||
"expression":"1 > 2"
|
||||
@@ -2351,7 +2352,7 @@ func TestIntegrationEval(t *testing.T) {
|
||||
"from": 18000,
|
||||
"to": 10800
|
||||
},
|
||||
"datasourceUid": "-100",
|
||||
"datasourceUid": "__expr__",
|
||||
"model": {
|
||||
"type":"math",
|
||||
"expression":"1 < 2"
|
||||
@@ -2408,7 +2409,7 @@ func TestIntegrationEval(t *testing.T) {
|
||||
"from": 18000,
|
||||
"to": 10800
|
||||
},
|
||||
"datasourceUid": "-100",
|
||||
"datasourceUid": "__expr__",
|
||||
"model": {
|
||||
"type":"math",
|
||||
"expression":"1 > 2"
|
||||
|
||||
Reference in New Issue
Block a user