tripnomics_7.5.5/pkg/tsdb/cloudwatch/time_series_query_test.go
venbatechnologies@gmail.com 91fce5c4bf Initial commit
2021-07-05 13:49:40 +05:30

24 lines
840 B
Go

package cloudwatch
import (
"context"
"testing"
"github.com/grafana/grafana/pkg/tsdb"
"github.com/stretchr/testify/assert"
)
func TestTimeSeriesQuery(t *testing.T) {
executor := newExecutor(nil, newTestConfig(), fakeSessionCache{})
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")
})
}