-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcall-function.feature
87 lines (79 loc) · 3.46 KB
/
call-function.feature
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Feature: call-functions
Background:
Given input topic
| topic | alias | key_type | value_type |
| topic-string | topic_in | string | string |
And output topic
| topic | alias | key_type | value_type | readTimeoutInSecond |
| topic-string | topic_out | string | string | 5 |
Scenario: uuid
Given var foo = bar
And var uuid = call function : uuid
And var isUUID = call script : /features/scripts/isUUID.sh ${uuid}
And var isNotUUID = call script : /features/scripts/isUUID.sh ${foo}
When records with key and value are sent
| topic_alias | key | value |
| topic_in | isUUID | ${isUUID} |
| topic_in | isNotUUID | ${isNotUUID} |
Then expected records
| topic_alias | key | value |
| topic_out | isUUID | aliasValue1 |
| topic_out | isNotUUID | aliasValue2 |
And assert aliasValue1 $ == "true"
And assert aliasValue2 $ == "false"
Scenario: sleep_now
Given var date_before = call function : now
And var print_first = call function : print sleep before ${date_before}
When var sleep = call function : sleep 5000
And var date_after = call function : now
And var print_second = call function : print sleep after ${date_after}
Scenario: uppercase
Given var foo = bar
And var uppercaseFoo = call function : uppercase ${foo}
When records with key and value are sent
| topic_alias | key | value |
| topic_in | UPPERCASE | ${uppercaseFoo} |
Then expected records
| topic_alias | key | value |
| topic_out | UPPERCASE | aliasValue1 |
And assert aliasValue1 $ == "BAR"
Scenario: lowercase
Given var foo = BAR
And var uppercaseFoo = call function : lowercase ${foo}
When records with key and value are sent
| topic_alias | key | value |
| topic_in | lowercase | ${uppercaseFoo} |
Then expected records
| topic_alias | key | value |
| topic_out | lowercase | aliasValue1 |
And assert aliasValue1 $ == "bar"
Scenario: sha256
Given var foo = some description to hash
And var sha256Foo = call function : sha256 ${foo}
When records with key and value are sent
| topic_alias | key | value |
| topic_in | sha256 | ${sha256Foo} |
Then expected records
| topic_alias | key | value |
| topic_out | sha256 | aliasValue1 |
And assert aliasValue1 $ == "c4503e8f44c69fea01bca0a28acd5ca9f82d31dd287c9200729d7b11f5658be5"
Scenario: sha1
Given var foo = some description to hash
And var sha1Foo = call function : sha1 ${foo}
When records with key and value are sent
| topic_alias | key | value |
| topic_in | sha1 | ${sha1Foo} |
Then expected records
| topic_alias | key | value |
| topic_out | sha1 | aliasValue1 |
And assert aliasValue1 $ == "398ccd6616fb1ec2086eddfccea671823b58f466"
Scenario: sha1_Interpolation
Given var foo = some description to hash
And var sha1Foo = call function : sha1 ${foo}bar
When records with key and value are sent
| topic_alias | key | value |
| topic_in | sha1Inter | ${sha1Foo} |
Then expected records
| topic_alias | key | value |
| topic_out | sha1Inter | aliasValue1 |
And assert aliasValue1 $ == "aee512dd2d5d0f3ec26df2b2e0d583fe81a88ab4"