mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
cc6df0ac6b
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
24 lines
808 B
Go
24 lines
808 B
Go
package cloudwatch
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestTimeSeriesQuery(t *testing.T) {
|
|
executor := &CloudWatchExecutor{}
|
|
|
|
t.Run("End time before start time should result in error", func(t *testing.T) {
|
|
_, err := executor.executeTimeSeriesQuery(context.TODO(), &tsdb.TsdbQuery{TimeRange: tsdb.NewTimeRange("now-1h", "now-2h")})
|
|
assert.EqualError(t, err, "invalid time range: start time must be before end time")
|
|
})
|
|
|
|
t.Run("End time equals start time should result in error", func(t *testing.T) {
|
|
_, err := executor.executeTimeSeriesQuery(context.TODO(), &tsdb.TsdbQuery{TimeRange: tsdb.NewTimeRange("now-1h", "now-1h")})
|
|
assert.EqualError(t, err, "invalid time range: start time must be before end time")
|
|
})
|
|
}
|