Skip to content

Commit 3ba01a4

Browse files
add test case for json array variation values (FF-2903) (#50)
* add test case for json array variation values (FF-2903) * add obfuscated case from eppo main repo
1 parent 830f20f commit 3ba01a4

File tree

3 files changed

+290
-1
lines changed

3 files changed

+290
-1
lines changed

ufc/flags-v1-obfuscated.json

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"createdAt": "2024-04-17T19:40:53.716Z",
32
"environment": {
43
"name": "Test"
54
},
5+
"createdAt": "2024-04-17T19:40:53.716Z",
66
"flags": {
77
"73fcc84c69e49e31fe16a29b2b1f803b": {
88
"key": "73fcc84c69e49e31fe16a29b2b1f803b",
@@ -1185,6 +1185,77 @@
11851185
]
11861186
}
11871187
]
1188+
},
1189+
"858b28fb6c4573445fbcf1568527e345": {
1190+
"key": "858b28fb6c4573445fbcf1568527e345",
1191+
"enabled": true,
1192+
"variationType": "JSON",
1193+
"totalShards": 10000,
1194+
"variations": {
1195+
"b25l": {
1196+
"key": "b25l",
1197+
"value": "W3sgImludGVnZXIiOiAxLCAic3RyaW5nIjogIm9uZSIsICJmbG9hdCI6IDEuMCB9LCB7ICJpbnRlZ2VyIjogMiwgInN0cmluZyI6ICJ0d28iLCAiZmxvYXQiOiAyLjAgfV0="
1198+
},
1199+
"dHdv": {
1200+
"key": "dHdv",
1201+
"value": "W3sgImludGVnZXIiOiAzLCAic3RyaW5nIjogInRocmVlIiwgImZsb2F0IjogMy4wIH0sIHsgImludGVnZXIiOiA0LCAic3RyaW5nIjogImZvdXIiLCAiZmxvYXQiOiA0LjAgfV0="
1202+
}
1203+
},
1204+
"allocations": [
1205+
{
1206+
"key": "NTAvNTAgc3BsaXQ=",
1207+
"doLog": true,
1208+
"rules": [],
1209+
"splits": [
1210+
{
1211+
"variationKey": "b25l",
1212+
"shards": [
1213+
{
1214+
"ranges": [
1215+
{
1216+
"start": 0,
1217+
"end": 10000
1218+
}
1219+
],
1220+
"salt": "dHJhZmZpYy1qc29uLWZsYWc="
1221+
},
1222+
{
1223+
"ranges": [
1224+
{
1225+
"start": 0,
1226+
"end": 5000
1227+
}
1228+
],
1229+
"salt": "c3BsaXQtanNvbi1mbGFn"
1230+
}
1231+
]
1232+
},
1233+
{
1234+
"variationKey": "dHdv",
1235+
"shards": [
1236+
{
1237+
"ranges": [
1238+
{
1239+
"start": 0,
1240+
"end": 10000
1241+
}
1242+
],
1243+
"salt": "dHJhZmZpYy1qc29uLWZsYWc="
1244+
},
1245+
{
1246+
"ranges": [
1247+
{
1248+
"start": 5000,
1249+
"end": 10000
1250+
}
1251+
],
1252+
"salt": "c3BsaXQtanNvbi1mbGFn"
1253+
}
1254+
]
1255+
}
1256+
]
1257+
}
1258+
]
11881259
}
11891260
}
11901261
}

ufc/flags-v1.json

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,77 @@
11851185
}
11861186
],
11871187
"totalShards": 10000
1188+
},
1189+
"json-array-config-flag": {
1190+
"key": "json-array-config-flag",
1191+
"enabled": true,
1192+
"variationType": "JSON",
1193+
"variations": {
1194+
"one": {
1195+
"key": "one",
1196+
"value": "[{ \"integer\": 1, \"string\": \"one\", \"float\": 1.0 }, { \"integer\": 2, \"string\": \"two\", \"float\": 2.0 }]"
1197+
},
1198+
"two": {
1199+
"key": "two",
1200+
"value": "[{ \"integer\": 3, \"string\": \"three\", \"float\": 3.0 }, { \"integer\": 4, \"string\": \"four\", \"float\": 4.0 }]"
1201+
}
1202+
},
1203+
"allocations": [
1204+
{
1205+
"key": "50/50 split",
1206+
"rules": [],
1207+
"splits": [
1208+
{
1209+
"variationKey": "one",
1210+
"shards": [
1211+
{
1212+
"salt": "traffic-json-flag",
1213+
"ranges": [
1214+
{
1215+
"start": 0,
1216+
"end": 10000
1217+
}
1218+
]
1219+
},
1220+
{
1221+
"salt": "split-json-flag",
1222+
"ranges": [
1223+
{
1224+
"start": 0,
1225+
"end": 5000
1226+
}
1227+
]
1228+
}
1229+
]
1230+
},
1231+
{
1232+
"variationKey": "two",
1233+
"shards": [
1234+
{
1235+
"salt": "traffic-json-flag",
1236+
"ranges": [
1237+
{
1238+
"start": 0,
1239+
"end": 10000
1240+
}
1241+
]
1242+
},
1243+
{
1244+
"salt": "split-json-flag",
1245+
"ranges": [
1246+
{
1247+
"start": 5000,
1248+
"end": 10000
1249+
}
1250+
]
1251+
}
1252+
]
1253+
}
1254+
],
1255+
"doLog": true
1256+
}
1257+
],
1258+
"totalShards": 10000
11881259
}
11891260
}
11901261
}
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
{
2+
"flag": "json-array-config-flag",
3+
"variationType": "JSON",
4+
"defaultValue": [],
5+
"subjects": [
6+
{
7+
"subjectKey": "alice",
8+
"subjectAttributes": {
9+
"email": "[email protected]",
10+
"country": "US"
11+
},
12+
"assignment": [
13+
{
14+
"integer": 1,
15+
"string": "one",
16+
"float": 1.0
17+
},
18+
{
19+
"integer": 2,
20+
"string": "two",
21+
"float": 2.0
22+
}
23+
],
24+
"evaluationDetails": {
25+
"environmentName": "Test",
26+
"flagEvaluationCode": "MATCH",
27+
"flagEvaluationDescription": "alice belongs to the range of traffic assigned to \"one\" defined in allocation \"50/50 split\".",
28+
"banditKey": null,
29+
"banditAction": null,
30+
"variationKey": "one",
31+
"variationValue": [
32+
{
33+
"integer": 1,
34+
"string": "one",
35+
"float": 1.0
36+
},
37+
{
38+
"integer": 2,
39+
"string": "two",
40+
"float": 2.0
41+
}
42+
],
43+
"matchedRule": null,
44+
"matchedAllocation": {
45+
"key": "50/50 split",
46+
"allocationEvaluationCode": "MATCH",
47+
"orderPosition": 1
48+
},
49+
"unmatchedAllocations": [],
50+
"unevaluatedAllocations": []
51+
}
52+
},
53+
{
54+
"subjectKey": "bob",
55+
"subjectAttributes": {
56+
"email": "[email protected]",
57+
"country": "Canada"
58+
},
59+
"assignment": [
60+
{
61+
"integer": 3,
62+
"string": "three",
63+
"float": 3.0
64+
},
65+
{
66+
"integer": 4,
67+
"string": "four",
68+
"float": 4.0
69+
}
70+
],
71+
"evaluationDetails": {
72+
"environmentName": "Test",
73+
"flagEvaluationCode": "MATCH",
74+
"flagEvaluationDescription": "bob belongs to the range of traffic assigned to \"two\" defined in allocation \"50/50 split\".",
75+
"banditKey": null,
76+
"banditAction": null,
77+
"variationKey": "two",
78+
"variationValue": [
79+
{
80+
"integer": 3,
81+
"string": "three",
82+
"float": 3.0
83+
},
84+
{
85+
"integer": 4,
86+
"string": "four",
87+
"float": 4.0
88+
}
89+
],
90+
"matchedRule": null,
91+
"matchedAllocation": {
92+
"key": "50/50 split",
93+
"allocationEvaluationCode": "MATCH",
94+
"orderPosition": 1
95+
},
96+
"unmatchedAllocations": [],
97+
"unevaluatedAllocations": []
98+
}
99+
},
100+
{
101+
"subjectKey": "charlie",
102+
"subjectAttributes": {
103+
"age": 50
104+
},
105+
"assignment": [
106+
{
107+
"integer": 3,
108+
"string": "three",
109+
"float": 3.0
110+
},
111+
{
112+
"integer": 4,
113+
"string": "four",
114+
"float": 4.0
115+
}
116+
],
117+
"evaluationDetails": {
118+
"environmentName": "Test",
119+
"flagEvaluationCode": "MATCH",
120+
"flagEvaluationDescription": "charlie belongs to the range of traffic assigned to \"two\" defined in allocation \"50/50 split\".",
121+
"banditKey": null,
122+
"banditAction": null,
123+
"variationKey": "two",
124+
"variationValue": [
125+
{
126+
"integer": 3,
127+
"string": "three",
128+
"float": 3.0
129+
},
130+
{
131+
"integer": 4,
132+
"string": "four",
133+
"float": 4.0
134+
}
135+
],
136+
"matchedRule": null,
137+
"matchedAllocation": {
138+
"key": "50/50 split",
139+
"allocationEvaluationCode": "MATCH",
140+
"orderPosition": 1
141+
},
142+
"unmatchedAllocations": [],
143+
"unevaluatedAllocations": []
144+
}
145+
}
146+
]
147+
}

0 commit comments

Comments
 (0)