@ -503,12 +503,12 @@ func TestIntegrationAlertAndGroupsQuery(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "AlwaysFiring" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -644,12 +644,12 @@ func TestIntegrationRulerAccess(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : fmt . Sprintf ( "AlwaysFiring %d" , i ) ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -886,7 +886,7 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
} ,
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "AlwaysFiring" ,
Data : [ ] ng models. AlertQuery { } ,
Data : [ ] api models. AlertQuery { } ,
} ,
} ,
expectedMessage : "invalid rule specification at index [0]: invalid alert rule: no queries or expressions are found" ,
@ -903,12 +903,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -933,12 +933,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : getLongString ( t , ngstore . AlertRuleMaxTitleLength + 1 ) ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -963,12 +963,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "AlwaysFiring" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -994,12 +994,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "AlwaysFiring" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -1024,12 +1024,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "AlwaysFiring" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : "unknown" ,
Model : json . RawMessage ( ` {
@ -1054,12 +1054,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "AlwaysFiring" ,
Condition : "B" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -1113,12 +1113,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "AlwaysFiring" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -1133,12 +1133,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "AlwaysFiringButSilenced" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -1300,12 +1300,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
UID : "unknown" ,
Title : "AlwaysNormal" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -1373,12 +1373,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
UID : ruleUID ,
Title : "AlwaysNormal" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -1407,12 +1407,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
UID : ruleUID ,
Title : "AlwaysAlerting" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -1481,12 +1481,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
UID : ruleUID , // Including the UID in the payload makes the endpoint update the existing rule.
Title : "AlwaysNormal" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -1599,12 +1599,12 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
UID : ruleUID , // Including the UID in the payload makes the endpoint update the existing rule.
Title : "AlwaysNormal" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -1958,12 +1958,12 @@ func TestIntegrationQuota(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "One more alert rule" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {
@ -1993,12 +1993,12 @@ func TestIntegrationQuota(t *testing.T) {
GrafanaManagedAlert : & apimodels . PostableGrafanaRule {
Title : "Updated alert rule" ,
Condition : "A" ,
Data : [ ] ng models. AlertQuery {
Data : [ ] api models. AlertQuery {
{
RefID : "A" ,
RelativeTimeRange : ng models. RelativeTimeRange {
From : ng models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : ng models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
RelativeTimeRange : api models. RelativeTimeRange {
From : api models. Duration ( time . Duration ( 5 ) * time . Hour ) ,
To : api models. Duration ( time . Duration ( 3 ) * time . Hour ) ,
} ,
DatasourceUID : expr . DatasourceUID ,
Model : json . RawMessage ( ` {