fix: verify raw freshness by received time
This commit is contained in:
@@ -370,3 +370,17 @@ func TestBuildRawFrameSQLUsesLiteralsForTDengine(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildRawFrameSQLCanOrderByReceivedAt(t *testing.T) {
|
||||
sqlText, args := buildRawFrameSQL("lingniu_vehicle_ts.raw_frames", RawFrameQuery{
|
||||
Protocol: "JT808",
|
||||
OrderBy: "receivedAt",
|
||||
Limit: 1,
|
||||
})
|
||||
if len(args) != 0 {
|
||||
t.Fatalf("expected no query args for TDengine, got %#v", args)
|
||||
}
|
||||
if !strings.Contains(sqlText, "ORDER BY received_at DESC LIMIT 1 OFFSET 0") {
|
||||
t.Fatalf("sql should order by received_at: %s", sqlText)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user