Skip to content

Conversation

rashidsp
Copy link
Contributor

Summary

  • Incorporated new decision notification listener changes.

Test plan

  • Added unit tests for type feature-test and project config method.
  • Updated unit tests.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0003%) to 99.949% when pulling d8540df on rashid/decision-listener-new-changes into 9250847 on master.

@coveralls
Copy link

coveralls commented Apr 19, 2019

Coverage Status

Coverage increased (+0.0003%) to 99.949% when pulling 77d8052 on rashid/decision-listener-new-changes into 9250847 on master.

@msohailhussain msohailhussain requested a review from a team April 19, 2019 17:31
@@ -137,6 +137,9 @@ def get_variation(experiment_key, user_id, attributes = nil)
}, @logger, Logger::ERROR
)

experiment = @config.get_experiment_from_key(experiment_key)
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@aliabbasrizvi aliabbasrizvi left a comment

Choose a reason for hiding this comment

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

@mikeng13 would like your thoughts on whether we should fix our test data to better represent the state of a datafile.

Changes look good otherwise with minor recommendations.

@@ -451,6 +460,16 @@ def get_rollout_from_id(rollout_id)
nil
end

def feature_experiment?(experiment_id)
# Determines if a given experiment ID belongs to any Feature.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. Determines if a given experiment ID is related to a feature. or Determines if given experiment is a feature test.

@@ -59,6 +59,21 @@
'test_event_not_running' => config_body['events'][3]
}

expected_experiment_feature_map = {
'133331' => [
Copy link
Contributor

Choose a reason for hiding this comment

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

An experiment having 2+ feature flags associated with it is an unexpected state. This points to me that the data we are testing with is incorrect / unexpected. Experiment to feature relationship is a many to one mapping and not many to many mapping.

cc @mikeng13

Copy link
Contributor

Choose a reason for hiding this comment

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

I just checked and these are mutex experiments, for which we do allow multiple features to be associated. So I think this data representation is correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just synced offline with @aliabbasrizvi and turns out I had it backwards. An experiment can only be associated to one feature at a time. We should definitely fix this test data as it would otherwise suggest an erroneous case.

describe '#feature_experiment' do
let(:config) { Optimizely::ProjectConfig.new(config_body_JSON, logger, error_handler) }

it 'should return true if the experiment belongs to any feature' do
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. .... if the experiment is a feature test

expect(config.feature_experiment?(experiment['id'])).to eq(true)
end

it 'should return false if the experiment does not belong to any feature' do
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. .... if the experiment is not a feature test

@aliabbasrizvi aliabbasrizvi merged commit 9d0de5f into master Apr 23, 2019
@aliabbasrizvi aliabbasrizvi deleted the rashid/decision-listener-new-changes branch April 23, 2019 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants