Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test case for json array variation values (FF-2903) #50

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 72 additions & 1 deletion ufc/flags-v1-obfuscated.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"createdAt": "2024-04-17T19:40:53.716Z",
"environment": {
"name": "Test"
},
"createdAt": "2024-04-17T19:40:53.716Z",
"flags": {
"73fcc84c69e49e31fe16a29b2b1f803b": {
"key": "73fcc84c69e49e31fe16a29b2b1f803b",
Expand Down Expand Up @@ -1185,6 +1185,77 @@
]
}
]
},
"858b28fb6c4573445fbcf1568527e345": {
"key": "858b28fb6c4573445fbcf1568527e345",
"enabled": true,
"variationType": "JSON",
"totalShards": 10000,
"variations": {
"b25l": {
"key": "b25l",
"value": "W3sgImludGVnZXIiOiAxLCAic3RyaW5nIjogIm9uZSIsICJmbG9hdCI6IDEuMCB9LCB7ICJpbnRlZ2VyIjogMiwgInN0cmluZyI6ICJ0d28iLCAiZmxvYXQiOiAyLjAgfV0="
},
"dHdv": {
"key": "dHdv",
"value": "W3sgImludGVnZXIiOiAzLCAic3RyaW5nIjogInRocmVlIiwgImZsb2F0IjogMy4wIH0sIHsgImludGVnZXIiOiA0LCAic3RyaW5nIjogImZvdXIiLCAiZmxvYXQiOiA0LjAgfV0="
}
},
"allocations": [
{
"key": "NTAvNTAgc3BsaXQ=",
"doLog": true,
"rules": [],
"splits": [
{
"variationKey": "b25l",
"shards": [
{
"ranges": [
{
"start": 0,
"end": 10000
}
],
"salt": "dHJhZmZpYy1qc29uLWZsYWc="
},
{
"ranges": [
{
"start": 0,
"end": 5000
}
],
"salt": "c3BsaXQtanNvbi1mbGFn"
}
]
},
{
"variationKey": "dHdv",
"shards": [
{
"ranges": [
{
"start": 0,
"end": 10000
}
],
"salt": "dHJhZmZpYy1qc29uLWZsYWc="
},
{
"ranges": [
{
"start": 5000,
"end": 10000
}
],
"salt": "c3BsaXQtanNvbi1mbGFn"
}
]
}
]
}
]
}
}
}
71 changes: 71 additions & 0 deletions ufc/flags-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,77 @@
}
],
"totalShards": 10000
},
"json-array-config-flag": {
"key": "json-array-config-flag",
"enabled": true,
"variationType": "JSON",
"variations": {
"one": {
"key": "one",
"value": "[{ \"integer\": 1, \"string\": \"one\", \"float\": 1.0 }, { \"integer\": 2, \"string\": \"two\", \"float\": 2.0 }]"
},
"two": {
"key": "two",
"value": "[{ \"integer\": 3, \"string\": \"three\", \"float\": 3.0 }, { \"integer\": 4, \"string\": \"four\", \"float\": 4.0 }]"
}
},
"allocations": [
{
"key": "50/50 split",
"rules": [],
"splits": [
{
"variationKey": "one",
"shards": [
{
"salt": "traffic-json-flag",
"ranges": [
{
"start": 0,
"end": 10000
}
]
},
{
"salt": "split-json-flag",
"ranges": [
{
"start": 0,
"end": 5000
}
]
}
]
},
{
"variationKey": "two",
"shards": [
{
"salt": "traffic-json-flag",
"ranges": [
{
"start": 0,
"end": 10000
}
]
},
{
"salt": "split-json-flag",
"ranges": [
{
"start": 5000,
"end": 10000
}
]
}
]
}
],
"doLog": true
}
],
"totalShards": 10000
}
}
}
147 changes: 147 additions & 0 deletions ufc/tests/test-json-array-config-flag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"flag": "json-array-config-flag",
"variationType": "JSON",
"defaultValue": [],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default is an array

"subjects": [
{
"subjectKey": "alice",
"subjectAttributes": {
"email": "[email protected]",
"country": "US"
},
"assignment": [
{
"integer": 1,
"string": "one",
"float": 1.0
},
{
"integer": 2,
"string": "two",
"float": 2.0
}
],
"evaluationDetails": {
"environmentName": "Test",
"flagEvaluationCode": "MATCH",
"flagEvaluationDescription": "alice belongs to the range of traffic assigned to \"one\" defined in allocation \"50/50 split\".",
"banditKey": null,
"banditAction": null,
"variationKey": "one",
"variationValue": [
{
"integer": 1,
"string": "one",
"float": 1.0
},
{
"integer": 2,
"string": "two",
"float": 2.0
}
],
"matchedRule": null,
"matchedAllocation": {
"key": "50/50 split",
"allocationEvaluationCode": "MATCH",
"orderPosition": 1
},
"unmatchedAllocations": [],
"unevaluatedAllocations": []
}
},
{
"subjectKey": "bob",
"subjectAttributes": {
"email": "[email protected]",
"country": "Canada"
},
"assignment": [
{
"integer": 3,
"string": "three",
"float": 3.0
},
{
"integer": 4,
"string": "four",
"float": 4.0
}
],
"evaluationDetails": {
"environmentName": "Test",
"flagEvaluationCode": "MATCH",
"flagEvaluationDescription": "bob belongs to the range of traffic assigned to \"two\" defined in allocation \"50/50 split\".",
"banditKey": null,
"banditAction": null,
"variationKey": "two",
"variationValue": [
{
"integer": 3,
"string": "three",
"float": 3.0
},
{
"integer": 4,
"string": "four",
"float": 4.0
}
],
"matchedRule": null,
"matchedAllocation": {
"key": "50/50 split",
"allocationEvaluationCode": "MATCH",
"orderPosition": 1
},
"unmatchedAllocations": [],
"unevaluatedAllocations": []
}
},
{
"subjectKey": "charlie",
"subjectAttributes": {
"age": 50
},
"assignment": [
{
"integer": 3,
"string": "three",
"float": 3.0
},
{
"integer": 4,
"string": "four",
"float": 4.0
}
],
"evaluationDetails": {
"environmentName": "Test",
"flagEvaluationCode": "MATCH",
"flagEvaluationDescription": "charlie belongs to the range of traffic assigned to \"two\" defined in allocation \"50/50 split\".",
"banditKey": null,
"banditAction": null,
"variationKey": "two",
"variationValue": [
{
"integer": 3,
"string": "three",
"float": 3.0
},
{
"integer": 4,
"string": "four",
"float": 4.0
}
],
"matchedRule": null,
"matchedAllocation": {
"key": "50/50 split",
"allocationEvaluationCode": "MATCH",
"orderPosition": 1
},
"unmatchedAllocations": [],
"unevaluatedAllocations": []
}
}
]
}
Loading