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)
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)
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)
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)
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)
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)
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)
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)
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)