Skip to content

Commit

Permalink
fix integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Wahl <mwahl@wayfair.com>
  • Loading branch information
Matthias Wahl committed Mar 16, 2021
1 parent ed943cc commit 107dbdb
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 21 deletions.
18 changes: 1 addition & 17 deletions tremor-cli/tests/integration/window_empty_windows/assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,4 @@ status: 0
name: emit empty windows
asserts:
- source: out.log
contains:
- |
["my_window",1,"SNOT",false,[1,2,3],[{}]]
- |
["my_window",1,"BADGER",false,[4,5,6],[{}]]
- |
["my_window",1,"SNOT",true,[7,8,9],[{}]]
- |
["my_window",2,"BADGER",true,[],[{},{}]]
- |
["my_window",0,"SNOT",false,null,[]]
- |
["my_window",0,"BADGER",false,null,[]]
- |
["my_window",0,"SNOT",true,null,[]]
- |
["my_window",0,"BADGER",true,null,[]]
equals_file: expected.json
7 changes: 4 additions & 3 deletions tremor-cli/tests/integration/window_empty_windows/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ onramp:
type: file
config:
source: in.json
sleep_on_done: 2000
close_on_done: true
offramp:
- id: out
type: file
config:
file: out.log
- id: exit
type: exit

binding:
- id: bind
links:
"/onramp/in/{i}/out": ["/pipeline/main/{i}/in"]
"/pipeline/main/{i}/out": ["/offramp/out/{i}/out"]
"/pipeline/main/{i}/out": ["/offramp/out/{i}/in"]
"/pipeline/main/{i}/err": ["/offramp/exit/{i}/in"]
mapping:
/binding/bind/01:
i: "01"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
["my_window",1,"SNOT",false,[1,2,3],[{}]]
["my_window",1,"BADGER",false,[4,5,6],[{}]]
["my_window",1,"SNOT",true,[7,8,9],[{}]]
["my_window",2,"BADGER",true,[],[{},{}]]
["my_window",0,"SNOT",false,null,[]]
["my_window",0,"BADGER",false,null,[]]
["my_window",0,"SNOT",true,null,[]]
["my_window",0,"BADGER",true,null,[]]
28 changes: 27 additions & 1 deletion tremor-cli/tests/integration/window_empty_windows/main.trickle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::string;
use std::record;

define tumbling window my_window
with
Expand All @@ -11,6 +12,28 @@ with
emit_empty_windows = true
end;

# expect 4 empty window events
define script handle_exit_condition
script
use std::type;
let state = match [state, event[1]] of
case %(null, 0) => {"count": 1}
case %(_, 0) => {"count": state.count + 1}
default => state
end;

match state of
case %{ count == 5 } =>
emit {"exit": 0} => "err"
case %{ present count } when state.count > 5 =>
drop
default =>
emit event => "out"
end
end;

create script handle_exit_condition;

select
[
window,
Expand All @@ -22,4 +45,7 @@ select
]
from in[my_window, my_other_window]
group by set(event.name, not event.bool)
into out;
into handle_exit_condition;

select event from handle_exit_condition/out into out;
select event from handle_exit_condition/err into err;

0 comments on commit 107dbdb

Please sign in to comment.