fix(flags): added cache invalidation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.test import TestCase
|
||||
|
||||
from apps.decision.services import decide_for_flag
|
||||
from apps.flags.models import (
|
||||
FeatureFlagType,
|
||||
validate_value_for_type,
|
||||
@@ -159,6 +160,20 @@ class FeatureFlagServiceTest(TestCase):
|
||||
with self.assertRaises(ValidationError):
|
||||
feature_flag_update_default(flag=flag, default_value="bad")
|
||||
|
||||
def test_update_default_invalidates_decide_flag_cache(self) -> None:
|
||||
flag = feature_flag_create(
|
||||
key="svc_upd_cache",
|
||||
name="Update Cache",
|
||||
value_type=FeatureFlagType.STRING,
|
||||
default_value="old",
|
||||
)
|
||||
first = decide_for_flag(flag.key, "svc_subj_1", {})
|
||||
self.assertEqual(first["value"], "old")
|
||||
feature_flag_update_default(flag=flag, default_value="new")
|
||||
second = decide_for_flag(flag.key, "svc_subj_2", {})
|
||||
self.assertEqual(second["reason"], "no_active_experiment")
|
||||
self.assertEqual(second["value"], "new")
|
||||
|
||||
|
||||
class FeatureFlagSelectorTest(TestCase):
|
||||
def test_list_all(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user