-
Notifications
You must be signed in to change notification settings - Fork 483
/
0002-delim.sh
executable file
·62 lines (39 loc) · 954 Bytes
/
0002-delim.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
#
set -e
source helpers.sh
#
# Verify that single and multi-byte delimiters work.
#
topic=$(make_topic_name)
# Multi-byte delimiters, partition 0
echo -n "Key1;KeyDel;Value1:MyDilemma::MyDilemma:;KeyDel;Value2:MyDilemma:Key3;KeyDel;:MyDilemma:Value4" |
$KCAT -t $topic -p 0 -K ';KeyDel;' -D ':MyDilemma:' -Z
output=$($KCAT -C -t $topic -p 0 -o beginning -e -J |
jq -r '.key + "=" + .payload')
exp="Key1=Value1
=Value2
Key3=
=Value4"
if [[ $output != $exp ]]; then
echo "FAIL: Expected '$exp', not '$output'"
exit 1
fi
#
# Single-byte delimiters, partition 1
#
echo "The First;Message1
Is The;
;Greatest
For sure" |
$KCAT -t $topic -p 1 -K ';' -Z
output=$($KCAT -C -t $topic -p 1 -o beginning -e -J |
jq -r '.key + "=" + .payload')
exp="The First=Message1
Is The=
=Greatest
=For sure"
if [[ $output != $exp ]]; then
echo "FAIL: Expected '$exp', not '$output'"
exit 1
fi