Open benmanns opened 1 month ago
When working on #244 and #245, I noticed that the tests can fail successfully if no messages are produced.
@test "websocket-connector-test" { count=1 echo "Starting consumer on topic $TOPIC" sleep 13 fluvio consume -B -d $TOPIC | while read input; do expected="Hello, Fluvio! - $count" echo $input = $expected [ "$input" = "$expected" ] count=$(($count + 1)) if [ $count -eq 10 ]; then break; fi done }
If fluvio consume -B -d $TOPIC produced no lines, nothing gets tested. I tested a new method that I think works pretty well:
fluvio consume -B -d $TOPIC
@test "websocket-connector-test" { count=1 echo "Starting consumer on topic $TOPIC" sleep 13 expected=<<EOF Hello, Fluvio! - 1 Hello, Fluvio! - 2 Hello, Fluvio! - 3 Hello, Fluvio! - 4 Hello, Fluvio! - 5 Hello, Fluvio! - 6 Hello, Fluvio! - 7 Hello, Fluvio! - 8 Hello, Fluvio! - 9 Hello, Fluvio! - 10 EOF run fluvio consume -B -d $TOPIC [[ $output = $expected* ]] }
I check against $expected as a prefix because the tests tend to exit and re-run which duplicates the output.
$expected
When working on #244 and #245, I noticed that the tests can fail successfully if no messages are produced.
If
fluvio consume -B -d $TOPIC
produced no lines, nothing gets tested. I tested a new method that I think works pretty well:I check against
$expected
as a prefix because the tests tend to exit and re-run which duplicates the output.