You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expectedWhereStr: "((Path IN ('first.metric','first.metric.','second.metric','second.metric.')) AND (Level=20002)) AND (Date='1970-02-12')",
195
+
},
196
+
{
197
+
name: "wildcard in queries, reverse preferred, no daily",
198
+
givenQueries: []string{
199
+
"*.first.metric",
200
+
"*.second.metric",
201
+
},
202
+
dailyEnabled: false,
203
+
expectedWhereStr: "(((Path LIKE 'metric.first.%') OR (Path LIKE 'metric.second.%')) AND (Level=30003)) AND (Date='1970-02-12')",
204
+
},
205
+
{
206
+
name: "no wildcards in queries, daily enabled, but no from and until",
207
+
givenQueries: []string{
208
+
"first.metric",
209
+
"second.metric",
210
+
},
211
+
dailyEnabled: true,
212
+
expectedWhereStr: "((Path IN ('first.metric','first.metric.','second.metric','second.metric.')) AND (Level=20002)) AND (Date='1970-02-12')",
213
+
},
214
+
{
215
+
name: "no wildcards in queries, daily enabled, has from, until",
216
+
givenQueries: []string{
217
+
"first.metric",
218
+
"second.metric",
219
+
},
220
+
givenFrom: someFrom,
221
+
givenUntil: someFrom,
222
+
dailyEnabled: true,
223
+
expectedWhereStr: "((Path IN ('first.metric','first.metric.','second.metric','second.metric.')) AND (Level=2)) AND (Date >='"+
224
+
date.FromTimestampToDaysFormat(someFrom) +"' AND Date <= '"+date.UntilTimestampToDaysFormat(someUntil) +"')",
225
+
},
226
+
{
227
+
name: "wildcard in queries, reverse preferred, daily enabled, no from, until",
228
+
givenQueries: []string{
229
+
"*.first.metric",
230
+
"*.second.metric",
231
+
},
232
+
dailyEnabled: true,
233
+
expectedWhereStr: "(((Path LIKE 'metric.first.%') OR (Path LIKE 'metric.second.%')) AND (Level=30003)) AND (Date='1970-02-12')",
234
+
},
235
+
{
236
+
name: "wildcard in queries, reverse preferred, daily enabled, has from, until",
237
+
givenQueries: []string{
238
+
"*.first.metric",
239
+
"*.second.metric",
240
+
},
241
+
dailyEnabled: true,
242
+
givenFrom: someFrom,
243
+
givenUntil: someUntil,
244
+
expectedWhereStr: "(((Path LIKE 'metric.first.%') OR (Path LIKE 'metric.second.%')) AND (Level=10003)) AND (Date >='"+
245
+
date.FromTimestampToDaysFormat(someFrom) +"' AND Date <= '"+date.UntilTimestampToDaysFormat(someUntil) +"')",
246
+
},
247
+
{
248
+
name: "some queries have wildcard, daily enabled, has from, until",
249
+
givenQueries: []string{
250
+
"help.*first.metric",
251
+
"help.second.metric",
252
+
"help.th*rd.metric",
253
+
"help.forth.metric",
254
+
},
255
+
dailyEnabled: true,
256
+
givenFrom: someFrom,
257
+
givenUntil: someUntil,
258
+
expectedWhereStr: "((((Path LIKE 'help.%' AND match(Path, '^help[.]([^.]*?)first[.]metric[.]?$')) OR (Path LIKE 'help.th%' AND match(Path, '^help[.]th([^.]*?)rd[.]metric[.]?$'))) OR (Path IN ('help.second.metric','help.second.metric.','help.forth.metric','help.forth.metric.'))) AND (Level=3)) AND (Date >='"+
259
+
date.FromTimestampToDaysFormat(someFrom) +"' AND Date <= '"+date.UntilTimestampToDaysFormat(someUntil) +"')",
260
+
},
261
+
{
262
+
name: "some queries have wildcard, daily enabled, has from, until, but reverse preferred",
263
+
givenQueries: []string{
264
+
"help.*first.metric.count",
265
+
"help.second.metric.count",
266
+
"help.th*rd.metric.count",
267
+
"help.forth.metric.count",
268
+
},
269
+
dailyEnabled: true,
270
+
givenFrom: someFrom,
271
+
givenUntil: someUntil,
272
+
expectedWhereStr: "((((Path LIKE 'count.metric.%' AND match(Path, '^count[.]metric[.]([^.]*?)first[.]help[.]?$')) OR (Path LIKE 'count.metric.th%' AND match(Path, '^count[.]metric[.]th([^.]*?)rd[.]help[.]?$'))) OR (Path IN ('count.metric.second.help','count.metric.second.help.','count.metric.forth.help','count.metric.forth.help.'))) AND (Level=10004)) AND (Date >='"+
273
+
date.FromTimestampToDaysFormat(someFrom) +"' AND Date <= '"+date.UntilTimestampToDaysFormat(someUntil) +"')",
274
+
expectedErr: nil,
275
+
},
276
+
{
277
+
name: "some queries have wildcard, daily enabled, has from, until, but reverse preferred, first query has no wildcard",
278
+
givenQueries: []string{
279
+
"help.second.metric.count",
280
+
"help.*first.metric.count",
281
+
"help.th*rd.metric.count",
282
+
"help.forth.metric.count",
283
+
},
284
+
dailyEnabled: true,
285
+
givenFrom: someFrom,
286
+
givenUntil: someUntil,
287
+
expectedWhereStr: "((((Path LIKE 'count.metric.%' AND match(Path, '^count[.]metric[.]([^.]*?)first[.]help[.]?$')) OR (Path LIKE 'count.metric.th%' AND match(Path, '^count[.]metric[.]th([^.]*?)rd[.]help[.]?$'))) OR (Path IN ('count.metric.second.help','count.metric.second.help.','count.metric.forth.help','count.metric.forth.help.'))) AND (Level=10004)) AND (Date >='"+
288
+
date.FromTimestampToDaysFormat(someFrom) +"' AND Date <= '"+date.UntilTimestampToDaysFormat(someUntil) +"')",
0 commit comments