Skip to content

Commit

Permalink
expr test: make sure the resulting metric names don't have wildcards
Browse files Browse the repository at this point in the history
  • Loading branch information
JaderDias committed Oct 14, 2016
1 parent 6544f9a commit dddd742
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions expr/expr_test.go
Expand Up @@ -490,6 +490,19 @@ func TestEvalExpression(t *testing.T) {
},
[]*MetricData{makeResponse("metric", []float64{1, 2, 3, 4, 5}, 1, now32)},
},
{
&expr{target: "metric*"},
map[MetricRequest][]*MetricData{
MetricRequest{"metric*", 0, 1}: {
makeResponse("metric1", []float64{1, 2, 3, 4, 5}, 1, now32),
makeResponse("metric2", []float64{2, 3, 4, 5, 6}, 1, now32),
},
},
[]*MetricData{
makeResponse("metric1", []float64{1, 2, 3, 4, 5}, 1, now32),
makeResponse("metric2", []float64{2, 3, 4, 5, 6}, 1, now32),
},
},
{
&expr{
target: "sum",
Expand Down Expand Up @@ -838,6 +851,26 @@ func TestEvalExpression(t *testing.T) {
},
[]*MetricData{makeResponse("keepLastValue(metric1)", []float64{math.NaN(), 2, 2, 2, 2, 2, 4, 5}, 1, now32)},
},
{
&expr{
target: "keepLastValue",
etype: etFunc,
args: []*expr{
{target: "metric*"},
},
argString: "metric*",
},
map[MetricRequest][]*MetricData{
MetricRequest{"metric*", 0, 1}: {
makeResponse("metric1", []float64{1, math.NaN(), math.NaN(), math.NaN(), math.NaN(), math.NaN(), 4, 5}, 1, now32),
makeResponse("metric2", []float64{math.NaN(), 2, math.NaN(), math.NaN(), math.NaN(), math.NaN(), 4, 5}, 1, now32),
},
},
[]*MetricData{
makeResponse("keepLastValue(metric1)", []float64{1, 1, 1, 1, 1, 1, 4, 5}, 1, now32),
makeResponse("keepLastValue(metric2)", []float64{math.NaN(), 2, 2, 2, 2, 2, 4, 5}, 1, now32),
},
},
{
&expr{
target: "changed",
Expand Down

0 comments on commit dddd742

Please sign in to comment.