Skip to content

Commit acb47ae

Browse files
authored
fixes for dpl test cases with incorrect timestamp formats (#577)
* fixes for dpl test cases with incorrect timestamp formats * remove sout * add Z for query timestamps in BloomFilterOperationsTest
1 parent 243a3ad commit acb47ae

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/test/java/com/teragrep/pth10/BloomFilterOperationsTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void tearDown() {
111111
public void estimateTest() {
112112
streamingTestUtil
113113
.performDPLTest(
114-
"index=index_A earliest=2020-01-01T00:00:00z latest=2023-01-01T00:00:00z | teragrep exec tokenizer | teragrep exec bloom estimate",
114+
"index=index_A earliest=2020-01-01T00:00:00Z latest=2023-01-01T00:00:00Z | teragrep exec tokenizer | teragrep exec bloom estimate",
115115
testFile, ds -> {
116116
final StructType expectedSchema = new StructType(new StructField[] {
117117
new StructField(
@@ -154,7 +154,7 @@ public void testEstimateOnEmptyArray() {
154154
streamingTestUtil
155155
.performDPLTest(
156156
// index_Empty _raw = "" so tokenizer step will produce an empty array
157-
"index=index_Empty earliest=2020-01-01T00:00:00z latest=2023-01-01T00:00:00z | teragrep exec tokenizer | teragrep exec bloom estimate",
157+
"index=index_Empty earliest=2020-01-01T00:00:00Z latest=2023-01-01T00:00:00Z | teragrep exec tokenizer | teragrep exec bloom estimate",
158158
testFile, ds -> {
159159
final StructType expectedSchema = new StructType(new StructField[] {
160160
new StructField(
@@ -201,7 +201,7 @@ public void testAggregateWithTokenizerFormatBytes() {
201201
properties.put("dpl.pth_06.bloom.db.fields", "[ {expected: 100, fpp: 0.01}]");
202202
streamingTestUtil
203203
.performDPLTest(
204-
"index=index_A earliest=2020-01-01T00:00:00z latest=2023-01-01T00:00:00z "
204+
"index=index_A earliest=2020-01-01T00:00:00Z latest=2023-01-01T00:00:00Z "
205205
+ "| teragrep exec tokenizer format bytes "
206206
+ "| teragrep exec hdfs save overwrite=true /tmp/pth_10_hdfs/aggregatorTokenBytes/"
207207
+ id,
@@ -266,7 +266,7 @@ public void testAggregateUsingRegexExtract() {
266266
final String regex = "\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}";
267267
streamingTestUtil
268268
.performDPLTest(
269-
"index=index_A earliest=2020-01-01T00:00:00z latest=2023-01-01T00:00:00z "
269+
"index=index_A earliest=2020-01-01T00:00:00Z latest=2023-01-01T00:00:00Z "
270270
+ "| teragrep exec regexextract regex " + regex
271271
+ "| teragrep exec hdfs save overwrite=true /tmp/pth_10_hdfs/aggregatorTokenBytes/"
272272
+ id,

src/test/java/com/teragrep/pth10/CatalystVisitorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ void searchQueryWithNotTest() {
108108
matches = "true"
109109
)
110110
void searchQueryWithOrTest() {
111-
final String query = "(index!=strawberry sourcetype=example:strawberry:strawberry host=loadbalancer.example.com) OR (index=* host=firewall.example.com earliest=2021-01-26T00:00:00z latest=2021-04-26T00:00:00z \"Denied\")";
112-
final String expected = "(((NOT RLIKE(index, (?i)^strawberry$)) AND (RLIKE(sourcetype, (?i)^example:strawberry:strawberry) AND RLIKE(host, (?i)^loadbalancer.example.com))) OR (RLIKE(index, (?i)^.*$) AND (((RLIKE(host, (?i)^firewall.example.com) AND (_time >= from_unixtime(1611612000, yyyy-MM-dd HH:mm:ss))) AND (_time < from_unixtime(1619384400, yyyy-MM-dd HH:mm:ss))) AND RLIKE(_raw, (?i)^.*\\QDenied\\E.*))))";
111+
final String query = "(index!=strawberry sourcetype=example:strawberry:strawberry host=loadbalancer.example.com) OR (index=* host=firewall.example.com earliest=2021-01-26T00:00:00Z latest=2021-04-26T00:00:00Z \"Denied\")";
112+
final String expected = "(((NOT RLIKE(index, (?i)^strawberry$)) AND (RLIKE(sourcetype, (?i)^example:strawberry:strawberry) AND RLIKE(host, (?i)^loadbalancer.example.com))) OR (RLIKE(index, (?i)^.*$) AND (((RLIKE(host, (?i)^firewall.example.com) AND (_time >= from_unixtime(1611619200, yyyy-MM-dd HH:mm:ss))) AND (_time < from_unixtime(1619395200, yyyy-MM-dd HH:mm:ss))) AND RLIKE(_raw, (?i)^.*\\QDenied\\E.*))))";
113113
this.streamingTestUtil.performDPLTest(query, this.testFile, res -> {
114114
DPLParserCatalystContext ctx = this.streamingTestUtil.getCtx();
115115
Assertions.assertEquals(expected, ctx.getSparkQuery());

src/test/java/com/teragrep/pth10/TimechartStreamingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void tearDown() {
110110
public void testTimechartBinSizeForMonthSpan() {
111111
streamingTestUtil
112112
.performDPLTest(
113-
"index=index_A earliest=2020-01-01T00:00:00z latest=2021-01-01T00:00:00z | timechart span=1mon count(_raw) as craw by sourcetype",
113+
"index=index_A earliest=2020-01-01T00:00:00Z latest=2021-01-01T00:00:00Z | timechart span=1mon count(_raw) as craw by sourcetype",
114114
testFile, ds -> {
115115
final StructType expectedSchema = new StructType(new StructField[] {
116116
new StructField(
@@ -149,7 +149,7 @@ public void testTimechartBinSizeForMonthSpan() {
149149
public void testTimechartBinSizeForMinuteSpan() {
150150
streamingTestUtil
151151
.performDPLTest(
152-
"index=index_A earliest=2020-12-12T00:00:00z latest=2020-12-12T00:30:00z | timechart span=1min count(_raw) as craw by sourcetype",
152+
"index=index_A earliest=2020-12-12T00:00:00Z latest=2020-12-12T00:30:00Z | timechart span=1min count(_raw) as craw by sourcetype",
153153
testFile, ds -> {
154154
final StructType expectedSchema = new StructType(new StructField[] {
155155
new StructField(

0 commit comments

Comments
 (0)