Rollout edit monitor to 10% users
Simplified the logic in whether to enable edit monitor by passing the
rollout percentage directly instead of reading from a env variable as
now we do not rely on any env var to control the rollout precentage.
Test: atest edit_monitor_utils_test
Bug: 365617369
Change-Id: Ia04d5737dafe2c9715a02f84eb5d75ba6119ceb4
diff --git a/tools/edit_monitor/utils_test.py b/tools/edit_monitor/utils_test.py
index 7d7e4b2..1c30aa1 100644
--- a/tools/edit_monitor/utils_test.py
+++ b/tools/edit_monitor/utils_test.py
@@ -46,60 +46,23 @@
)
)
- @mock.patch.dict(
- os.environ, {ROLLOUT_TEST_FEATURE_FLAG: 'invalid'}, clear=True
- )
- def test_feature_disabled_with_invalid_rollout_percentage(self):
- self.assertFalse(
- utils.is_feature_enabled(
- TEST_FEATURE,
- TEST_USER,
- ENABLE_TEST_FEATURE_FLAG,
- ROLLOUT_TEST_FEATURE_FLAG,
- )
- )
-
- @mock.patch.dict(os.environ, {ROLLOUT_TEST_FEATURE_FLAG: '101'}, clear=True)
- def test_feature_disabled_with_rollout_percentage_too_high(self):
- self.assertFalse(
- utils.is_feature_enabled(
- TEST_FEATURE,
- TEST_USER,
- ENABLE_TEST_FEATURE_FLAG,
- ROLLOUT_TEST_FEATURE_FLAG,
- )
- )
-
- @mock.patch.dict(os.environ, {ROLLOUT_TEST_FEATURE_FLAG: '-1'}, clear=True)
- def test_feature_disabled_with_rollout_percentage_too_low(self):
- self.assertFalse(
- utils.is_feature_enabled(
- TEST_FEATURE,
- TEST_USER,
- ENABLE_TEST_FEATURE_FLAG,
- ROLLOUT_TEST_FEATURE_FLAG,
- )
- )
-
- @mock.patch.dict(os.environ, {ROLLOUT_TEST_FEATURE_FLAG: '90'}, clear=True)
def test_feature_enabled_with_rollout_percentage(self):
self.assertTrue(
utils.is_feature_enabled(
TEST_FEATURE,
TEST_USER,
ENABLE_TEST_FEATURE_FLAG,
- ROLLOUT_TEST_FEATURE_FLAG,
+ 90,
)
)
- @mock.patch.dict(os.environ, {ROLLOUT_TEST_FEATURE_FLAG: '10'}, clear=True)
def test_feature_disabled_with_rollout_percentage(self):
self.assertFalse(
utils.is_feature_enabled(
TEST_FEATURE,
TEST_USER,
ENABLE_TEST_FEATURE_FLAG,
- ROLLOUT_TEST_FEATURE_FLAG,
+ 10,
)
)