Skip to content

Commit

Permalink
Evaluation log test data
Browse files Browse the repository at this point in the history
  • Loading branch information
adams85 committed Aug 3, 2023
1 parent 0eac7c4 commit 4a01780
Show file tree
Hide file tree
Showing 46 changed files with 593 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"sdkKey": "PKDVCLf-Hq-h-kCzMp-L7Q/psuH7BGHoUmdONrzzUOY7A",
"tests": [
{
"key": "stringContainsDogDefaultCat",
"defaultValue": "default",
"returnValue": "Cat",
"expectedLog": "1_rule_no_user.txt"
},
{
"key": "stringContainsDogDefaultCat",
"defaultValue": "default",
"user": {
"Identifier": "12345"
},
"returnValue": "Cat",
"expectedLog": "1_rule_no_targeted_attribute.txt"
},
{
"key": "stringContainsDogDefaultCat",
"defaultValue": "default",
"user": {
"Identifier": "12345",
"Email": "[email protected]"
},
"returnValue": "Cat",
"expectedLog": "1_rule_not_matching_targeted_attribute.txt"
},
{
"key": "stringContainsDogDefaultCat",
"defaultValue": "default",
"user": {
"Identifier": "12345",
"Email": "[email protected]"
},
"returnValue": "Dog",
"expectedLog": "1_rule_matching_targeted_attribute.txt"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INFO [5000] Evaluating 'stringContainsDogDefaultCat' for User '{"Identifier": "12345", "Email": "[email protected]", "Country": null, "Custom": null}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email CONTAINS ANY OF ['@configcat.com'] THEN 'Dog' => MATCH, applying rule
Returning 'Dog'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INFO [5000] Evaluating 'stringContainsDogDefaultCat' for User '{"Identifier": "12345", "Email": null, "Country": null, "Custom": null}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email CONTAINS ANY OF ['@configcat.com'] THEN 'Dog' => no match
Returning 'Cat'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
WARNING [3001] Cannot evaluate targeting rules and % options for setting 'stringContainsDogDefaultCat' (User Object is missing). You should pass a User Object to the evaluation methods like `get_value()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
INFO [5000] Evaluating 'stringContainsDogDefaultCat'
Evaluating targeting rules and applying the first match if any:
- IF User.Email CONTAINS ANY OF ['@configcat.com'] THEN 'Dog' => cannot evaluate, User Object is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
Returning 'Cat'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INFO [5000] Evaluating 'stringContainsDogDefaultCat' for User '{"Identifier": "12345", "Email": "[email protected]", "Country": null, "Custom": null}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email CONTAINS ANY OF ['@configcat.com'] THEN 'Dog' => no match
Returning 'Cat'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"sdkKey": "PKDVCLf-Hq-h-kCzMp-L7Q/psuH7BGHoUmdONrzzUOY7A",
"tests": [
{
"key": "stringIsInDogDefaultCat",
"defaultValue": "default",
"returnValue": "Cat",
"expectedLog": "2_rules_no_user.txt"
},
{
"key": "stringIsInDogDefaultCat",
"defaultValue": "default",
"user": {
"Identifier": "12345"
},
"returnValue": "Cat",
"expectedLog": "2_rules_no_targeted_attribute.txt"
},
{
"key": "stringIsInDogDefaultCat",
"defaultValue": "default",
"user": {
"Identifier": "12345",
"Custom1": "user"
},
"returnValue": "Cat",
"expectedLog": "2_rules_not_matching_targeted_attribute.txt"
},
{
"key": "stringIsInDogDefaultCat",
"defaultValue": "default",
"user": {
"Identifier": "12345",
"Custom1": "admin"
},
"returnValue": "Dog",
"expectedLog": "2_rules_matching_targeted_attribute.txt"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
INFO [5000] Evaluating 'stringIsInDogDefaultCat' for User '{"Identifier": "12345", "Email": null, "Country": null, "Custom": {"Custom1": "admin"}}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email IS ONE OF (hashed) ['a79a58142e...', '8af1824d6c...'] THEN 'Dog' => no match
- IF User.Custom1 IS ONE OF (hashed) ['e01dfbe824...'] THEN 'Dog' => MATCH, applying rule
Returning 'Dog'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
INFO [5000] Evaluating 'stringIsInDogDefaultCat' for User '{"Identifier": "12345", "Email": null, "Country": null, "Custom": null}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email IS ONE OF (hashed) ['a79a58142e...', '8af1824d6c...'] THEN 'Dog' => no match
- IF User.Custom1 IS ONE OF (hashed) ['e01dfbe824...'] THEN 'Dog' => no match
Returning 'Cat'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
WARNING [3001] Cannot evaluate targeting rules and % options for setting 'stringIsInDogDefaultCat' (User Object is missing). You should pass a User Object to the evaluation methods like `get_value()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
WARNING [3001] Cannot evaluate targeting rules and % options for setting 'stringIsInDogDefaultCat' (User Object is missing). You should pass a User Object to the evaluation methods like `get_value()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
INFO [5000] Evaluating 'stringIsInDogDefaultCat'
Evaluating targeting rules and applying the first match if any:
- IF User.Email IS ONE OF (hashed) ['a79a58142e...', '8af1824d6c...'] THEN 'Dog' => cannot evaluate, User Object is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
- IF User.Custom1 IS ONE OF (hashed) ['e01dfbe824...'] THEN 'Dog' => cannot evaluate, User Object is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
Returning 'Cat'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
INFO [5000] Evaluating 'stringIsInDogDefaultCat' for User '{"Identifier": "12345", "Email": null, "Country": null, "Custom": {"Custom1": "user"}}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email IS ONE OF (hashed) ['a79a58142e...', '8af1824d6c...'] THEN 'Dog' => no match
- IF User.Custom1 IS ONE OF (hashed) ['e01dfbe824...'] THEN 'Dog' => no match
Returning 'Cat'.
22 changes: 22 additions & 0 deletions src/ConfigCat.Client.Tests/data/evaluationlog/and_rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"sdkKey": "configcat-sdk-1/XUbbCFZX_0mOU_uQ_XYGMg/FfwncdJg1kq0lBqxhYC_7g",
"baseUrl": "https://test-cdn-eu.configcat.com",
"tests": [
{
"key": "emailAnd",
"defaultValue": "default",
"returnValue": "Cat",
"expectedLog": "and_rules_no_user.txt"
},
{
"key": "emailAnd",
"defaultValue": "default",
"user": {
"Identifier": "12345",
"Email": "[email protected]"
},
"returnValue": "Cat",
"expectedLog": "and_rules_user.txt"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
WARNING [3001] Cannot evaluate targeting rules and % options for setting 'emailAnd' (User Object is missing). You should pass a User Object to the evaluation methods like `get_value()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
INFO [5000] Evaluating 'emailAnd'
Evaluating targeting rules and applying the first match if any:
- IF User.Email STARTS WITH ANY OF (hashed) ['4_985cf0de...'] => False, skipping the remaining AND conditions
THEN 'Dog' => cannot evaluate, User Object is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
Returning 'Cat'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
INFO [5000] Evaluating 'emailAnd' for User '{"Identifier": "12345", "Email": "[email protected]", "Country": null, "Custom": null}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email STARTS WITH ANY OF (hashed) ['4_985cf0de...'] => True
AND User.Email CONTAINS ANY OF ['@'] => True
AND User.Email ENDS WITH (hashed) ['20_37bff8e...'] => False, skipping the remaining AND conditions
THEN 'Dog' => no match
Returning 'Cat'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"jsonOverride": "circular_dependency_override.json",
"sdkKey": "",
"baseUrl": "",
"tests": [
{
"key": "key1",
"defaultValue": "default",
"user": {
"Identifier": "1234"
},
"returnValue": "first",
"expectedLog": "circular_dependency.txt"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
WARNING [3005] Cannot evaluate targeting rules for 'key1' (circular dependency detected between the following depending flags: 'key1' -> 'key2' -> 'key1'). Please check your feature flag definition and eliminate the circular dependency.
INFO [5000] Evaluating 'key1' for User '{"Identifier": "1234", "Email": null, "Country": null, "Custom": null}'
Evaluating targeting rules and applying the first match if any:
- IF flag 'key2' EQUALS 'fourth'
(
Evaluating prerequisite flag 'key2':
Evaluating targeting rules and applying the first match if any:
- IF flag 'key1' EQUALS 'value1'
(
Evaluating prerequisite flag 'key1':THEN 'third' => Cannot evaluate targeting rules for 'key1' (circular dependency detected between the following depending flags: 'key1' -> 'key2' -> 'key1'). Please check your feature flag definition and eliminate the circular dependency.
The current targeting rule is ignored and the evaluation continues with the next rule.
- IF flag 'key3' EQUALS 'value3'
(
Evaluating prerequisite flag 'key3':
Prerequisite flag evaluation result: 'value3'
Condition: (Flag 'key3' EQUALS 'value3') evaluates to True.
)
THEN 'fourth' => MATCH, applying rule
Prerequisite flag evaluation result: 'fourth'
Condition: (Flag 'key2' EQUALS 'fourth') evaluates to True.
)
THEN 'first' => MATCH, applying rule
Returning 'first'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"p": {
"u": "https://cdn-global.configcat.com",
"r": 0
},
"f": {
"key1": { "v": { "s": "value1" },
"r": [
{"c": [{"d": {"f": "key2", "c": 0, "v": {"s": "fourth"}}}], "s": {"v": {"s": "first"}}},
{"c": [{"d": {"f": "key3", "c": 0, "v": {"s": "value3"}}}], "s": {"v": {"s": "second"}}}
]
},
"key2": { "v": { "s": "value2" },
"r": [
{"c": [{"d": {"f": "key1", "c": 0, "v": {"s": "value1"}}}], "s": {"v": {"s": "third"}}},
{"c": [{"d": {"f": "key3", "c": 0, "v": {"s": "value3"}}}], "s": {"v": {"s": "fourth"}}}
]
},
"key3": { "v": { "s": "value3" }}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"sdkKey": "PKDVCLf-Hq-h-kCzMp-L7Q/psuH7BGHoUmdONrzzUOY7A",
"tests": [
{
"key": "integer25One25Two25Three25FourAdvancedRules",
"defaultValue": 42,
"returnValue": -1,
"expectedLog": "options_after_targeting_rule_no_user.txt"
},
{
"key": "integer25One25Two25Three25FourAdvancedRules",
"defaultValue": 42,
"user": {
"Identifier": "12345"
},
"returnValue": 2,
"expectedLog": "options_after_targeting_rule_no_targeted_attribute.txt"
},
{
"key": "integer25One25Two25Three25FourAdvancedRules",
"defaultValue": 42,
"user": {
"Identifier": "12345",
"Email": "[email protected]"
},
"returnValue": 2,
"expectedLog": "options_after_targeting_rule_not_matching_targeted_attribute.txt"
},
{
"key": "integer25One25Two25Three25FourAdvancedRules",
"defaultValue": 42,
"user": {
"Identifier": "12345",
"Email": "[email protected]"
},
"returnValue": 5,
"expectedLog": "options_after_targeting_rule_matching_targeted_attribute.txt"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INFO [5000] Evaluating 'integer25One25Two25Three25FourAdvancedRules' for User '{"Identifier": "12345", "Email": "[email protected]", "Country": null, "Custom": null}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email CONTAINS ANY OF ['@configcat.com'] THEN '5' => MATCH, applying rule
Returning '5'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
INFO [5000] Evaluating 'integer25One25Two25Three25FourAdvancedRules' for User '{"Identifier": "12345", "Email": null, "Country": null, "Custom": null}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email CONTAINS ANY OF ['@configcat.com'] THEN '5' => no match
Evaluating % options based on the User.Identifier attribute:
- Computing hash in the [0..99] range from User.Identifier => 25 (this value is sticky and consistent across all SDKs)
- Hash value 25 selects % option 2 (50%), '2'
Returning '2'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
WARNING [3001] Cannot evaluate targeting rules and % options for setting 'integer25One25Two25Three25FourAdvancedRules' (User Object is missing). You should pass a User Object to the evaluation methods like `get_value()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
WARNING [3001] Cannot evaluate % options for setting 'integer25One25Two25Three25FourAdvancedRules' (User Object is missing). You should pass a User Object to the evaluation methods like `get_value()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
INFO [5000] Evaluating 'integer25One25Two25Three25FourAdvancedRules'
Evaluating targeting rules and applying the first match if any:
- IF User.Email CONTAINS ANY OF ['@configcat.com'] THEN '5' => cannot evaluate, User Object is missing
The current targeting rule is ignored and the evaluation continues with the next rule.
Skipping % options because the User Object is missing.
Returning '-1'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
INFO [5000] Evaluating 'integer25One25Two25Three25FourAdvancedRules' for User '{"Identifier": "12345", "Email": "[email protected]", "Country": null, "Custom": null}'
Evaluating targeting rules and applying the first match if any:
- IF User.Email CONTAINS ANY OF ['@configcat.com'] THEN '5' => no match
Evaluating % options based on the User.Identifier attribute:
- Computing hash in the [0..99] range from User.Identifier => 25 (this value is sticky and consistent across all SDKs)
- Hash value 25 selects % option 2 (50%), '2'
Returning '2'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"sdkKey": "configcat-sdk-1/XUbbCFZX_0mOU_uQ_XYGMg/x0tcrFMkl02A65D8GD20Eg",
"baseUrl": "https://test-cdn-eu.configcat.com",
"tests": [
{
"key": "string75Cat0Dog25Falcon0HorseCustomAttr",
"defaultValue": "default",
"returnValue": "Chicken",
"expectedLog": "options_custom_attribute_no_user.txt"
},
{
"key": "string75Cat0Dog25Falcon0HorseCustomAttr",
"defaultValue": "default",
"user": {
"Identifier": "12345"
},
"returnValue": "Chicken",
"expectedLog": "no_options_custom_attribute.txt"
},
{
"key": "string75Cat0Dog25Falcon0HorseCustomAttr",
"defaultValue": "default",
"user": {
"Identifier": "12345",
"Country": "US"
},
"returnValue": "Cat",
"expectedLog": "matching_options_custom_attribute.txt"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
INFO [5000] Evaluating 'string75Cat0Dog25Falcon0HorseCustomAttr' for User '{"Identifier": "12345", "Email": null, "Country": "US", "Custom": null}'
Evaluating % options based on the User.Country attribute:
- Computing hash in the [0..99] range from User.Country => 70 (this value is sticky and consistent across all SDKs)
- Hash value 70 selects % option 1 (75%), 'Cat'
Returning 'Cat'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INFO [5000] Evaluating 'string75Cat0Dog25Falcon0HorseCustomAttr' for User '{"Identifier": "12345", "Email": null, "Country": null, "Custom": null}'
Skipping % options because the User.Country attribute is missing.
The current targeting rule is ignored and the evaluation continues with the next rule.
Returning 'Chicken'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
WARNING [3001] Cannot evaluate % options for setting 'string75Cat0Dog25Falcon0HorseCustomAttr' (User Object is missing). You should pass a User Object to the evaluation methods like `get_value()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
INFO [5000] Evaluating 'string75Cat0Dog25Falcon0HorseCustomAttr'
Skipping % options because the User Object is missing.
Returning 'Chicken'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"sdkKey": "PKDVCLf-Hq-h-kCzMp-L7Q/psuH7BGHoUmdONrzzUOY7A",
"tests": [
{
"key": "string75Cat0Dog25Falcon0Horse",
"defaultValue": "default",
"returnValue": "Chicken",
"expectedLog": "options_user_attribute_no_user.txt"
},
{
"key": "string75Cat0Dog25Falcon0Horse",
"defaultValue": "default",
"user": {
"Identifier": "12345"
},
"returnValue": "Cat",
"expectedLog": "options_user_attribute_user.txt"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
WARNING [3001] Cannot evaluate % options for setting 'string75Cat0Dog25Falcon0Horse' (User Object is missing). You should pass a User Object to the evaluation methods like `get_value()` in order to make targeting work properly. Read more: https://configcat.com/docs/advanced/user-object/
INFO [5000] Evaluating 'string75Cat0Dog25Falcon0Horse'
Evaluating targeting rules and applying the first match if any:
Skipping % options because the User Object is missing.
Returning 'Chicken'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
INFO [5000] Evaluating 'string75Cat0Dog25Falcon0Horse' for User '{"Identifier": "12345", "Email": null, "Country": null, "Custom": null}'
Evaluating targeting rules and applying the first match if any:
Evaluating % options based on the User.Identifier attribute:
- Computing hash in the [0..99] range from User.Identifier => 21 (this value is sticky and consistent across all SDKs)
- Hash value 21 selects % option 1 (75%), 'Cat'
Returning 'Cat'.
Loading

0 comments on commit 4a01780

Please sign in to comment.