Пример #1
0
 def testGetExperimentStatusManuallyEnableMultipleEnttries(self):
     knobs = {experiments.MANUAL_ON_KNOB: [EXP_NAME, 'random']}
     ret = experiments.GetExperimentStatus(EXP_NAME, knobs,
                                           SAMPLE_50_EXPERIMENT)
     self.assertEqual(ret.status, experiments.ENABLED)
     self.assertEqual(ret.source, experiments.MANUAL)
     ret = experiments.GetExperimentStatus('random', knobs,
                                           SAMPLE_50_EXPERIMENT)
     self.assertEqual(ret.status, experiments.ENABLED)
     self.assertEqual(ret.source, experiments.MANUAL)
Пример #2
0
 def testGetExperimentStatusManuallyDisableWhenTrackEnabled(self):
     knobs = {experiments.MANUAL_OFF_KNOB: [EXP_NAME]}
     ret = experiments.GetExperimentStatus(EXP_NAME, knobs,
                                           SAMPLE_UNSTABLE_EXPERIMENT,
                                           'unstable')
     self.assertEqual(ret.status, experiments.DISABLED)
     self.assertEqual(ret.source, experiments.MANUAL)
Пример #3
0
 def testGetExperimentStatusDisabledViaUnstableTrackWhenStable(self, _):
     knobs = {}
     ret = experiments.GetExperimentStatus(EXP_NAME, knobs,
                                           SAMPLE_UNSTABLE_EXPERIMENT,
                                           'stable')
     self.assertEqual(ret.status, experiments.DISABLED)
     self.assertEqual(ret.source, experiments.AUTO)
Пример #4
0
 def testGetExperimentStatusEnabledViaTestingTrackWhenTesting(self):
     knobs = {}
     ret = experiments.GetExperimentStatus(EXP_NAME, knobs,
                                           SAMPLE_TESTING_EXPERIMENT,
                                           'testing')
     self.assertEqual(ret.status, experiments.ENABLED)
     self.assertEqual(ret.source, experiments.ALWAYS)
Пример #5
0
 def testGetExperimentStatusEnabledViaUnstableTrackWhenUnstable(self):
     knobs = {}
     ret = experiments.GetExperimentStatus(EXP_NAME, knobs,
                                           SAMPLE_UNSTABLE_EXPERIMENT,
                                           'unstable')
     self.assertEqual(ret.status, experiments.ENABLED)
     self.assertEqual(ret.source, experiments.ALWAYS)
Пример #6
0
 def testGetExperimentStatusBucketOff(self, mock_eib, _):
     knobs = {experiments.EXPERIMENTS_KNOB: experiments.AUTO}
     eib_ret = mock.MagicMock()
     eib_ret.source, eib_ret.status = experiments.AUTO, experiments.DISABLED
     mock_eib.return_value = eib_ret
     ret = experiments.GetExperimentStatus(EXP_NAME, knobs,
                                           SAMPLE_50_EXPERIMENT)
     self.assertEqual(ret.status, experiments.DISABLED)
     self.assertEqual(ret.source, experiments.AUTO)
Пример #7
0
 def testGetExperimentStatusHundrePercentIsAlwaysEnabled(self):
     knobs = {experiments.MANUAL_OFF_KNOB: [EXP_NAME]}
     ret = experiments.GetExperimentStatus(EXP_NAME, knobs,
                                           SAMPLE_100_EXPERIMENT)
     self.assertEqual(ret.status, experiments.ENABLED)
     self.assertEqual(ret.source, experiments.ALWAYS)
Пример #8
0
 def testGetExperimentStatusManuallyDisable(self):
     knobs = {experiments.MANUAL_OFF_KNOB: [EXP_NAME]}
     ret = experiments.GetExperimentStatus(EXP_NAME, knobs,
                                           SAMPLE_50_EXPERIMENT)
     self.assertEqual(ret.status, experiments.DISABLED)
     self.assertEqual(ret.source, experiments.MANUAL)
Пример #9
0
 def testGetExperimentStatusAlwaysDisabled(self):
     knobs = {experiments.EXPERIMENTS_KNOB: experiments.NEVER}
     ret = experiments.GetExperimentStatus(EXP_NAME, knobs,
                                           SAMPLE_50_EXPERIMENT)
     self.assertEqual(ret.status, experiments.DISABLED)
     self.assertEqual(ret.source, experiments.ALWAYS)