Skip to content

Commit f6859b6

Browse files
committed
fixed macro tests
1 parent 98a9a3a commit f6859b6

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pkg/macros/macros_test.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,16 @@ func TestInterpolate(t *testing.T) {
129129
tests := []test{
130130
{input: "select * from tab where tstmp >= $__fromTime ", output: "select * from tab where tstmp >= cast(1705754096789000 as timestamp) "},
131131
{input: "select * from tab where tstmp < $__toTime ", output: "select * from tab where tstmp < cast(1707559262123000 as timestamp) "},
132-
{input: "select * from tab where ( tstmp >= $__fromTime and tstmp <= $__toTime )", output: "select * from tab where ( tstmp >= cast(1705754096789000 as timestamp) and tstmp <= cast(1707559262123000 as timestamp) )"},
133-
{input: "select * from tab where ( tstmp >= $__fromTime ) and ( tstmp <= $__toTime )", output: "select * from tab where ( tstmp >= cast(1705754096789000 as timestamp) ) and ( tstmp <= cast(1707559262123000 as timestamp) )"},
134-
{input: "select * from tab where $__timeFilter(tstmp)", output: "select * from tab where tstmp >= 1705754096789000 AND tstmp <= 1707559262123000"},
135-
{input: "select * from tab where $__timeFilter( tstmp )", output: "select * from tab where tstmp >= 1705754096789000 AND tstmp <= 1707559262123000"},
136-
{input: "select * from tab where $__timeFilter( tstmp ) sample by $__sampleByInterval", output: "select * from tab where tstmp >= 1705754096789000 AND tstmp <= 1707559262123000 sample by 30s", duration: time.Duration(30000000000)},
137-
{input: "select * from tab where $__timeFilter( tstmp ) sample by $__sampleByInterval", output: "select * from tab where tstmp >= 1705754096789000 AND tstmp <= 1707559262123000 sample by 1T", duration: time.Duration(1000000)},
132+
{input: "select * from tab where ( tstmp >= $__fromTime and tstmp <= $__toTime )",
133+
output: "select * from tab where ( tstmp >= cast(1705754096789000 as timestamp) and tstmp <= cast(1707559262123000 as timestamp) )"},
134+
{input: "select * from tab where ( tstmp >= $__fromTime ) and ( tstmp <= $__toTime )",
135+
output: "select * from tab where ( tstmp >= cast(1705754096789000 as timestamp) ) and ( tstmp <= cast(1707559262123000 as timestamp) )"},
136+
{input: "select * from tab where $__timeFilter(tstmp)", output: "select * from tab where tstmp >= cast(1705754096789000 as timestamp) AND tstmp <= cast(1707559262123000 as timestamp)"},
137+
{input: "select * from tab where $__timeFilter( tstmp )", output: "select * from tab where tstmp >= cast(1705754096789000 as timestamp) AND tstmp <= cast(1707559262123000 as timestamp)"},
138+
{input: "select * from tab where $__timeFilter( tstmp ) sample by $__sampleByInterval",
139+
output: "select * from tab where tstmp >= cast(1705754096789000 as timestamp) AND tstmp <= cast(1707559262123000 as timestamp) sample by 30s", duration: time.Duration(30000000000)},
140+
{input: "select * from tab where $__timeFilter( tstmp ) sample by $__sampleByInterval",
141+
output: "select * from tab where tstmp >= cast(1705754096789000 as timestamp) AND tstmp <= cast(1707559262123000 as timestamp) sample by 1T", duration: time.Duration(1000000)},
138142
}
139143

140144
for i, tc := range tests {

0 commit comments

Comments
 (0)