diff --git a/lib/optimizely/bucketer.rb b/lib/optimizely/bucketer.rb index afa8f89b..0400f354 100644 --- a/lib/optimizely/bucketer.rb +++ b/lib/optimizely/bucketer.rb @@ -118,7 +118,6 @@ def find_bucket(bucketing_id, user_id, parent_id, traffic_allocations) message = "Assigned bucket #{bucket_value} to user '#{user_id}' with bucketing ID: '#{bucketing_id}'." @logger.log(Logger::DEBUG, message) - decide_reasons.push(message) traffic_allocations.each do |traffic_allocation| current_end_of_range = traffic_allocation['endOfRange'] diff --git a/spec/bucketing_spec.rb b/spec/bucketing_spec.rb index 8e68cd95..be3c4e48 100644 --- a/spec/bucketing_spec.rb +++ b/spec/bucketing_spec.rb @@ -85,7 +85,6 @@ def get_bucketing_key(bucketing_id, entity_id = nil) variation_received, reasons = bucketer.bucket(config, experiment, 'bucket_id_ignored', 'test_user') expect(variation_received).to be_nil expect(reasons).to eq([ - "Assigned bucket 3000 to user 'test_user' with bucketing ID: 'bucket_id_ignored'.", "User 'test_user' is not in experiment 'group1_exp2' of group 101." ]) expect(spy_logger).to have_received(:log) @@ -112,7 +111,7 @@ def get_bucketing_key(bucketing_id, entity_id = nil) expected_variation = config.get_variation_from_id('group2_exp1', '144443') variation_received, reasons = bucketer.bucket(config, experiment, 'bucket_id_ignored', 'test_user') expect(variation_received).to eq(expected_variation) - expect(reasons).to eq(["Assigned bucket 3000 to user 'test_user' with bucketing ID: 'bucket_id_ignored'."]) + expect(reasons).to eq([]) expect(spy_logger).to have_received(:log).once expect(spy_logger).to have_received(:log) .with(Logger::DEBUG, "Assigned bucket 3000 to user 'test_user' with bucketing ID: 'bucket_id_ignored'.") @@ -123,7 +122,7 @@ def get_bucketing_key(bucketing_id, entity_id = nil) experiment = config.get_experiment_from_key('group2_exp1') variation_received, reasons = bucketer.bucket(config, experiment, 'bucket_id_ignored', 'test_user') - expect(reasons).to eq(["Assigned bucket 50000 to user 'test_user' with bucketing ID: 'bucket_id_ignored'."]) + expect(reasons).to eq([]) expect(variation_received).to be_nil expect(spy_logger).to have_received(:log).once expect(spy_logger).to have_received(:log) @@ -170,14 +169,14 @@ def get_bucketing_key(bucketing_id, entity_id = nil) expected_variation = config.get_variation_from_id('test_experiment', '111128') variation_received, reasons = bucketer.bucket(config, experiment, 'test_user', 'test_user') expect(variation_received).to be(expected_variation) - expect(reasons).to eq(["Assigned bucket 4577 to user 'test_user' with bucketing ID: 'test_user'."]) + expect(reasons).to eq([]) # Bucketing with bucketing id - 'any_string789111127' produces bucket value btw 5000 to 10,000 # thus buckets to variation expected_variation = config.get_variation_from_id('test_experiment', '111129') variation_received, reasons = bucketer.bucket(config, experiment, 'any_string789', 'test_user') expect(variation_received).to be(expected_variation) - expect(reasons).to eq(["Assigned bucket 9941 to user 'test_user' with bucketing ID: 'any_string789'."]) + expect(reasons).to eq([]) end # Bucketing with invalid experiment key and bucketing ID @@ -196,14 +195,12 @@ def get_bucketing_key(bucketing_id, entity_id = nil) variation_received, reasons = bucketer.bucket(config, experiment, 'test_user', 'test_user') expect(variation_received).to be(expected_variation) expect(reasons).to eq([ - "Assigned bucket 7543 to user 'test_user' with bucketing ID: 'test_user'.", "User 'test_user' is not in experiment 'group1_exp1' of group 101." ]) expected_variation = config.get_variation_from_id('group1_exp1', '130002') variation_received, = bucketer.bucket(config, experiment, '123456789', 'test_user') expect(variation_received).to be(expected_variation) expect(reasons).to eq([ - "Assigned bucket 7543 to user 'test_user' with bucketing ID: 'test_user'.", "User 'test_user' is not in experiment 'group1_exp1' of group 101." ]) end diff --git a/spec/decision_service_spec.rb b/spec/decision_service_spec.rb index 14459826..13eb8269 100644 --- a/spec/decision_service_spec.rb +++ b/spec/decision_service_spec.rb @@ -72,7 +72,6 @@ expect(reasons).to eq([ "Audiences for experiment 'test_experiment' collectively evaluated to TRUE.", - "Assigned bucket 4577 to user 'test_user' with bucketing ID: 'test_user'.", "User 'test_user' is in variation 'control' of experiment 'test_experiment'." ]) @@ -229,7 +228,6 @@ expect(reasons).to eq([ "User 'forced_user_with_invalid_variation' is whitelisted into variation 'invalid_variation', which is not in the datafile.", "Audiences for experiment 'test_experiment' collectively evaluated to TRUE.", - "Assigned bucket 877 to user 'forced_user_with_invalid_variation' with bucketing ID: 'forced_user_with_invalid_variation'.", "User 'forced_user_with_invalid_variation' is in variation 'control' of experiment 'test_experiment'." ]) expect(spy_logger).to have_received(:log) @@ -259,7 +257,6 @@ expect(variation_received).to eq('111128') expect(reasons).to eq([ "Audiences for experiment 'test_experiment' collectively evaluated to TRUE.", - "Assigned bucket 4577 to user 'test_user' with bucketing ID: 'test_user'.", "User 'test_user' is in variation 'control' of experiment 'test_experiment'." ]) @@ -290,7 +287,6 @@ expect(variation_received).to eq('111129') expect(reasons).to eq([ "Audiences for experiment 'test_experiment' collectively evaluated to TRUE.", - "Assigned bucket 8933 to user 'test_user' with bucketing ID: 'pid'.", "User 'test_user' is in variation 'variation' of experiment 'test_experiment'." ]) @@ -347,7 +343,6 @@ expect(variation_received).to eq('111128') expect(reasons).to eq([ "Audiences for experiment 'test_experiment' collectively evaluated to TRUE.", - "Assigned bucket 4577 to user 'test_user' with bucketing ID: 'test_user'.", "User 'test_user' is in variation 'control' of experiment 'test_experiment'." ]) @@ -387,7 +382,6 @@ expect(reasons).to eq([ "User '' was previously bucketed into variation ID '111111' for experiment '111127', but no matching variation was found. Re-bucketing user.", "Audiences for experiment 'test_experiment' collectively evaluated to TRUE.", - "Assigned bucket 4577 to user 'test_user' with bucketing ID: 'test_user'.", "User 'test_user' is in variation 'control' of experiment 'test_experiment'." ]) @@ -414,7 +408,6 @@ expect(reasons).to eq([ "Error while looking up user profile for user ID 'test_user': uncaught throw :LookupError.", "Audiences for experiment 'test_experiment' collectively evaluated to TRUE.", - "Assigned bucket 4577 to user 'test_user' with bucketing ID: 'test_user'.", "User 'test_user' is in variation 'control' of experiment 'test_experiment'." ]) @@ -431,7 +424,6 @@ expect(variation_received).to eq('111128') expect(reasons).to eq([ "Audiences for experiment 'test_experiment' collectively evaluated to TRUE.", - "Assigned bucket 4577 to user 'test_user' with bucketing ID: 'test_user'.", "User 'test_user' is in variation 'control' of experiment 'test_experiment'." ]) @@ -448,7 +440,6 @@ expect(variation_received).to eq('111128') expect(reasons).to eq([ "Audiences for experiment 'test_experiment' collectively evaluated to TRUE.", - "Assigned bucket 4577 to user 'test_user' with bucketing ID: 'test_user'.", "User 'test_user' is in variation 'control' of experiment 'test_experiment'." ]) @@ -466,7 +457,6 @@ expect(variation_received).to eq('111128') expect(reasons).to eq([ "Audiences for experiment 'test_experiment' collectively evaluated to TRUE.", - "Assigned bucket 4577 to user 'test_user' with bucketing ID: 'test_user'.", "User 'test_user' is in variation 'control' of experiment 'test_experiment'." ])