You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2022/01/19 19:58:44 UTC
[incubator-streampipes] 03/03: [test] Add test for count aggregation
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 131f6dceadca2c99ecde57e6b63dcb39f4c66223
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Wed Jan 19 20:58:28 2022 +0100
[test] Add test for count aggregation
---
.../filters-siddhi/count1/description.json | 21 +++++++++++++++++++++
.../filters-siddhi/count1/expected.csv | 4 ++++
.../pipelineElement/filters-siddhi/count1/input.csv | 4 ++++
ui/cypress/support/model/PipelineElementInput.ts | 1 +
ui/cypress/support/utils/DataLakeUtils.ts | 4 ++--
.../support/utils/ProcessingElementTestUtils.ts | 2 +-
.../tests/pipelineElement/SinglePipelineElement.ts | 2 +-
7 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/ui/cypress/fixtures/pipelineElement/filters-siddhi/count1/description.json b/ui/cypress/fixtures/pipelineElement/filters-siddhi/count1/description.json
new file mode 100644
index 0000000..8c17a38
--- /dev/null
+++ b/ui/cypress/fixtures/pipelineElement/filters-siddhi/count1/description.json
@@ -0,0 +1,21 @@
+{
+ "name": "count_value_occurrence",
+ "ignoreTimestamp": true,
+ "config": [
+ {
+ "type": "drop-down",
+ "selector": "count-mapping",
+ "value": "text"
+ },
+ {
+ "type": "radio",
+ "selector": "scale",
+ "value": "Seconds"
+ },
+ {
+ "type": "input",
+ "selector": "time-window",
+ "value": "10"
+ }
+ ]
+}
diff --git a/ui/cypress/fixtures/pipelineElement/filters-siddhi/count1/expected.csv b/ui/cypress/fixtures/pipelineElement/filters-siddhi/count1/expected.csv
new file mode 100644
index 0000000..8dba7c6
--- /dev/null
+++ b/ui/cypress/fixtures/pipelineElement/filters-siddhi/count1/expected.csv
@@ -0,0 +1,4 @@
+time;count;value
+1623871499055;1.0;hello
+1623871503078;1.0;world
+1623871503079;2.0;hello
diff --git a/ui/cypress/fixtures/pipelineElement/filters-siddhi/count1/input.csv b/ui/cypress/fixtures/pipelineElement/filters-siddhi/count1/input.csv
new file mode 100644
index 0000000..a9b2ad7
--- /dev/null
+++ b/ui/cypress/fixtures/pipelineElement/filters-siddhi/count1/input.csv
@@ -0,0 +1,4 @@
+timestamp;text
+1623871499055;hello
+1623871503078;world
+1623871503079;hello
diff --git a/ui/cypress/support/model/PipelineElementInput.ts b/ui/cypress/support/model/PipelineElementInput.ts
index c58d5d3..8d36ff5 100644
--- a/ui/cypress/support/model/PipelineElementInput.ts
+++ b/ui/cypress/support/model/PipelineElementInput.ts
@@ -21,6 +21,7 @@ import { OutputStrategyConfig } from './OutputStrategyConfig';
export class PipelineElementInput {
name: string;
+ ignoreTimestamp?: boolean;
config: UserInput[];
output: OutputStrategyConfig;
}
diff --git a/ui/cypress/support/utils/DataLakeUtils.ts b/ui/cypress/support/utils/DataLakeUtils.ts
index 7f42345..9b31a78 100644
--- a/ui/cypress/support/utils/DataLakeUtils.ts
+++ b/ui/cypress/support/utils/DataLakeUtils.ts
@@ -206,7 +206,7 @@ export class DataLakeUtils {
cy.get('div').contains('DataLake').parent().click();
}
- public static checkResults(dataLakeIndex: string, fileRoute: string, ignoreTime: boolean = false) {
+ public static checkResults(dataLakeIndex: string, fileRoute: string, ignoreTime?: boolean) {
// Validate result in datalake
cy.request({
@@ -252,7 +252,7 @@ export class DataLakeUtils {
} else {
actualResult = DataLakeUtils.parseCsv(actual);
}
- const expectedResult = DataLakeUtils.parseCsv(expected);
+ const expectedResult = ignoreTime ? DataLakeUtils.parseCsv(expected).map(row => row.splice(1)) : DataLakeUtils.parseCsv(expected);
expect(actualResult).to.deep.equal(expectedResult);
}
diff --git a/ui/cypress/support/utils/ProcessingElementTestUtils.ts b/ui/cypress/support/utils/ProcessingElementTestUtils.ts
index c82d0f3..c531427 100644
--- a/ui/cypress/support/utils/ProcessingElementTestUtils.ts
+++ b/ui/cypress/support/utils/ProcessingElementTestUtils.ts
@@ -73,7 +73,7 @@ export class ProcessingElementTestUtils {
// Wait till data is stored
cy.wait(10000);
- DataLakeUtils.checkResults(dataLakeIndex, 'cypress/fixtures/' + expectedResultFile);
+ DataLakeUtils.checkResults(dataLakeIndex, 'cypress/fixtures/' + expectedResultFile, pipelineElementTest.processor.ignoreTimestamp);
}
}
diff --git a/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts b/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts
index b04f234..f7cd0ec 100644
--- a/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts
+++ b/ui/cypress/tests/pipelineElement/SinglePipelineElement.ts
@@ -22,7 +22,7 @@ import { ProcessorTest } from '../../support/model/ProcessorTest';
const allTests = Cypress.env('processingElements');
allTests.forEach(test => {
- const testNames = ['increase3'];
+ const testNames = ['increase1'];
const processorTest = test as ProcessorTest;