Error:fmt.Errorf("invalid format of evaluation results for the alert definition : unable to get frame row length: frame has different field lengths, field 0 is len 1 but field 1 is len 0"),
},
},
},
{
desc:"too many fields produces Error state result",
execResults:ExecutionResults{
Results:[]*data.Frame{
data.NewFrame("",
data.NewField("",nil,[]*float64{}),
data.NewField("",nil,[]*float64{}),
),
},
},
expectResultLength:1,
expectResults:Results{
{
State:Error,
Error:fmt.Errorf("invalid format of evaluation results for the alert definition : unexpected field length: 2 instead of 1"),
},
},
},
{
desc:"more than one row produces Error state result",
Error:fmt.Errorf("invalid format of evaluation results for the alert definition : unexpected row length: 2 instead of 0 or 1"),
},
},
},
{
desc:"time fields (looks like time series) returns error",
execResults:ExecutionResults{
Results:[]*data.Frame{
data.NewFrame("",
data.NewField("",nil,[]time.Time{}),
),
},
},
expectResultLength:1,
expectResults:Results{
{
State:Error,
Error:fmt.Errorf("invalid format of evaluation results for the alert definition : looks like time series data, only reduced data can be alerted on."),
},
},
},
{
desc:"non []*float64 field will produce Error state result",
execResults:ExecutionResults{
Results:[]*data.Frame{
data.NewFrame("",
data.NewField("",nil,[]float64{2}),
),
},
},
expectResultLength:1,
expectResults:Results{
{
State:Error,
Error:fmt.Errorf("invalid format of evaluation results for the alert definition : invalid field type: []float64"),
},
},
},
{
desc:"duplicate labels produce a single Error state result",
execResults:ExecutionResults{
Results:[]*data.Frame{
data.NewFrame("",
data.NewField("",nil,[]*float64{ptr.Float64(1)}),
),
data.NewFrame("",
data.NewField("",nil,[]*float64{ptr.Float64(2)}),
),
},
},
expectResultLength:1,
expectResults:Results{
{
State:Error,
Error:fmt.Errorf("invalid format of evaluation results for the alert definition : frame cannot uniquely be identified by its labels: has duplicate results with labels {}"),
},
},
},
{
desc:"error that produce duplicate empty labels produce a single Error state result",
Error:fmt.Errorf("invalid format of evaluation results for the alert definition : frame cannot uniquely be identified by its labels: has duplicate results with labels {}"),
},
},
},
{
desc:"certain errors will produce multiple mixed Error and other state results",