Skip to content

Commit 967546e

Browse files
authored
add more opt-config tests with duplicate keys (#423)
1 parent 8bae2b5 commit 967546e

File tree

4 files changed

+583
-588
lines changed

4 files changed

+583
-588
lines changed

OptimizelySwiftSDK.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,13 +2315,13 @@
23152315
path = "OptimizelyTests-MultiClients";
23162316
sourceTree = "<group>";
23172317
};
2318-
6E6BE008237F547200FE8274 /* optmizelyConfig */ = {
2318+
6E6BE008237F547200FE8274 /* optimizelyConfig */ = {
23192319
isa = PBXGroup;
23202320
children = (
23212321
6E6BE009237F547200FE8274 /* optimizely_config_datafile.json */,
23222322
6E6BE00A237F547200FE8274 /* optimizely_config_expected.json */,
23232323
);
2324-
path = optmizelyConfig;
2324+
path = optimizelyConfig;
23252325
sourceTree = "<group>";
23262326
};
23272327
6E75165D22C520D400B2B157 /* Sources */ = {
@@ -2529,7 +2529,7 @@
25292529
isa = PBXGroup;
25302530
children = (
25312531
6E75196322C5211100B2B157 /* benchmark */,
2532-
6E6BE008237F547200FE8274 /* optmizelyConfig */,
2532+
6E6BE008237F547200FE8274 /* optimizelyConfig */,
25332533
6EF8DE0924B8DA5D008B9488 /* decide */,
25342534
6E75196222C5211100B2B157 /* optimizely_6372300739_v4.json */,
25352535
6E75196722C5211100B2B157 /* feature_rollout_toggle_on.json */,

Tests/OptimizelyTests-APIs/OptimizelyClientTests_OptimizelyConfig.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class OptimizelyClientTests_OptimizelyConfig: XCTestCase {
121121

122122
print(" Experiments: \(optimizelyConfig.experimentsMap.keys)")
123123

124-
XCTAssertEqual(optimizelyConfig.experimentsMap.count, 5)
124+
XCTAssertEqual(optimizelyConfig.experimentsMap.count, 4)
125125

126126
let experiment1 = optimizelyConfig.experimentsMap["exp_with_audience"]!
127127
let experiment2 = optimizelyConfig.experimentsMap["experiment_4000"]!
@@ -167,7 +167,7 @@ class OptimizelyClientTests_OptimizelyConfig: XCTestCase {
167167
print(" Feature2 > Experiments: \(feature2.experimentsMap.keys)")
168168

169169
var experiment1 = feature1.experimentsMap["experiment_4000"]!
170-
var experiment2 = feature1.experimentsMap["experiment_8000"]!
170+
var experiment2 = feature1.experimentsMap["duplicate_experiment_key"]!
171171

172172
XCTAssertEqual(experiment1.variationsMap.count, 2)
173173
XCTAssertEqual(experiment2.variationsMap.count, 1)
@@ -217,7 +217,7 @@ class OptimizelyClientTests_OptimizelyConfig: XCTestCase {
217217
// FeatureFlag: deliveryRules
218218

219219
XCTAssertEqual(feature1.deliveryRules.count, 2)
220-
XCTAssertEqual(feature2.deliveryRules.count, 0)
220+
XCTAssertEqual(feature2.deliveryRules.count, 1)
221221

222222
experiment1 = feature1.deliveryRules[0]
223223
experiment2 = feature1.deliveryRules[1]

Tests/TestData/optmizelyConfig/optimizely_config_datafile.json renamed to Tests/TestData/optimizelyConfig/optimizely_config_datafile.json

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,36 @@
5858
}
5959
],
6060
"id": "rollout-2354-20348521767"
61+
},
62+
{
63+
"experiments": [
64+
{
65+
"status": "Running",
66+
"audienceConditions": [],
67+
"audienceIds": [],
68+
"variations": [
69+
{
70+
"variables": [],
71+
"id": "6328",
72+
"key": "off",
73+
"featureEnabled": false
74+
}
75+
],
76+
"forcedVariations": {},
77+
"key": "targeted_delivery",
78+
"layerId": "9300000005992",
79+
"trafficAllocation": [
80+
{
81+
"entityId": "6328",
82+
"endOfRange": 10000
83+
}
84+
],
85+
"id": "9300000005992"
86+
}
87+
],
88+
"id": "rollout-2354-20348521768"
6189
}
90+
6291
],
6392
"anonymizeIP": true,
6493
"projectId": "12254210345",
@@ -101,7 +130,7 @@
101130
"experimentIds": ["12198292376"],
102131
"id": "4482920079",
103132
"key": "feature_exp_no_traffic",
104-
"rolloutId": "",
133+
"rolloutId": "rollout-2354-20348521768",
105134
"variables": []
106135
}
107136
],
@@ -203,7 +232,7 @@
203232
},
204233
{
205234
"status": "Running",
206-
"key": "experiment_8000",
235+
"key": "duplicate_experiment_key",
207236
"layerId": "12187694825",
208237
"trafficAllocation": [
209238
{
@@ -284,7 +313,7 @@
284313
},
285314
{
286315
"status": "Running",
287-
"key": "no_traffic_experiment",
316+
"key": "duplicate_experiment_key",
288317
"layerId": "12187694826",
289318
"trafficAllocation": [
290319
{

0 commit comments

Comments
 (0)