Commit e5e9d3c2 by Daniel Lee

mssql: adds test for time should be ms in table mode

parent d34cd873
...@@ -654,6 +654,33 @@ func TestMSSQL(t *testing.T) { ...@@ -654,6 +654,33 @@ func TestMSSQL(t *testing.T) {
So(err, ShouldBeNil) So(err, ShouldBeNil)
So(len(queryResult.Tables[0].Rows), ShouldEqual, 3) So(len(queryResult.Tables[0].Rows), ShouldEqual, 3)
}) })
Convey("When doing an annotation query with a time column in datetime format", func() {
query := &tsdb.TsdbQuery{
Queries: []*tsdb.Query{
{
Model: simplejson.NewFromAny(map[string]interface{}{
"rawSql": "SELECT DATEADD(s, time_sec, {d '1970-01-01'}) AS time, description as [text], tags FROM [event] WHERE $__unixEpochFilter(time_sec) AND tags='ticket' ORDER BY 1 ASC",
"format": "table",
}),
RefId: "Tickets",
},
},
TimeRange: &tsdb.TimeRange{
From: fmt.Sprintf("%v", fromStart.Add(-20*time.Minute).Unix()*1000),
To: fmt.Sprintf("%v", fromStart.Add(40*time.Minute).Unix()*1000),
},
}
resp, err := endpoint.Query(nil, nil, query)
queryResult := resp.Results["Tickets"]
So(err, ShouldBeNil)
So(len(queryResult.Tables[0].Rows), ShouldEqual, 3)
columns := queryResult.Tables[0].Rows[0]
//Should be in milliseconds
So(columns[0].(float64), ShouldBeGreaterThan, 1000000000000)
})
}) })
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment