mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(testdata): lots of work on new test data data source and scenarios
This commit is contained in:
@@ -23,13 +23,13 @@ func TestTimeRange(t *testing.T) {
|
||||
fiveMinAgo, _ := time.ParseDuration("-5m")
|
||||
expected := now.Add(fiveMinAgo)
|
||||
|
||||
res, err := tr.FromTime()
|
||||
res, err := tr.ParseFrom()
|
||||
So(err, ShouldBeNil)
|
||||
So(res.Unix(), ShouldEqual, expected.Unix())
|
||||
})
|
||||
|
||||
Convey("now ", func() {
|
||||
res, err := tr.ToTime()
|
||||
res, err := tr.ParseTo()
|
||||
So(err, ShouldBeNil)
|
||||
So(res.Unix(), ShouldEqual, now.Unix())
|
||||
})
|
||||
@@ -46,7 +46,7 @@ func TestTimeRange(t *testing.T) {
|
||||
fiveHourAgo, _ := time.ParseDuration("-5h")
|
||||
expected := now.Add(fiveHourAgo)
|
||||
|
||||
res, err := tr.FromTime()
|
||||
res, err := tr.ParseFrom()
|
||||
So(err, ShouldBeNil)
|
||||
So(res.Unix(), ShouldEqual, expected.Unix())
|
||||
})
|
||||
@@ -54,7 +54,7 @@ func TestTimeRange(t *testing.T) {
|
||||
Convey("now-10m ", func() {
|
||||
fiveMinAgo, _ := time.ParseDuration("-10m")
|
||||
expected := now.Add(fiveMinAgo)
|
||||
res, err := tr.ToTime()
|
||||
res, err := tr.ParseTo()
|
||||
So(err, ShouldBeNil)
|
||||
So(res.Unix(), ShouldEqual, expected.Unix())
|
||||
})
|
||||
@@ -68,13 +68,13 @@ func TestTimeRange(t *testing.T) {
|
||||
Now: now,
|
||||
}
|
||||
|
||||
res, err := tr.FromTime()
|
||||
res, err := tr.ParseFrom()
|
||||
So(err, ShouldBeNil)
|
||||
So(res.Unix(), ShouldEqual, 1474973725473)
|
||||
So(res.UnixNano()/int64(time.Millisecond), ShouldEqual, 1474973725473)
|
||||
|
||||
res, err = tr.ToTime()
|
||||
res, err = tr.ParseTo()
|
||||
So(err, ShouldBeNil)
|
||||
So(res.Unix(), ShouldEqual, 1474975757930)
|
||||
So(res.UnixNano()/int64(time.Millisecond), ShouldEqual, 1474975757930)
|
||||
})
|
||||
|
||||
Convey("Cannot parse asdf", func() {
|
||||
@@ -85,10 +85,10 @@ func TestTimeRange(t *testing.T) {
|
||||
Now: now,
|
||||
}
|
||||
|
||||
_, err = tr.FromTime()
|
||||
_, err = tr.ParseFrom()
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
_, err = tr.ToTime()
|
||||
_, err = tr.ParseTo()
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user