forked from open-feature/spec
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooks.feature
More file actions
52 lines (47 loc) · 2.63 KB
/
hooks.feature
File metadata and controls
52 lines (47 loc) · 2.63 KB
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
@hooks
Feature: Evaluation details through hooks
# This test suite contains scenarios to test the functionality of hooks.
Background:
Given a stable provider
Scenario: Passes evaluation details to after and finally hooks
Given a client with added hook
And a boolean-flag with key "boolean-flag" and a default value "false"
When the flag was evaluated with details
Then the "before" hook should have been executed
And the "after, finally after" hooks should be called with evaluation details
| data_type | key | value |
| string | flag_key | boolean-flag |
| boolean | value | true |
| string | variant | on |
| string | reason | STATIC |
| string | error_code | None |
| string | error_message | None |
# errors
Scenario: Flag not found
Given a client with added hook
And a string-flag with key "missing-flag" and a default value "uh-oh"
When the flag was evaluated with details
Then the "before" hook should have been executed
And the "error" hook should have been executed
And the "finally after" hooks should be called with evaluation details
| data_type | key | value |
| string | flag_key | missing-flag |
| string | value | uh-oh |
| string | variant | None |
| string | reason | ERROR |
| string | error_code | ErrorCode.FLAG_NOT_FOUND |
| string | error_message | Flag 'missing-flag' not found |
Scenario: Type error
Given a client with added hook
And a string-flag with key "wrong-flag" and a default value "13"
When the flag was evaluated with details
Then the "before" hook should have been executed
And the "error" hook should have been executed
And the "finally after" hooks should be called with evaluation details
| data_type | key | value |
| string | flag_key | wrong-flag |
| integer | value | 13 |
| string | variant | None |
| string | reason | ERROR |
| string | error_code | ErrorCode.TYPE_MISMATCH |
| string | error_message | Expected type <class 'int'> but got <class 'str'> |