@@ -1049,3 +1049,87 @@ def check_eviction_policy_changed():
10491049 )
10501050
10511051 self .cluster .delete_bucket (bucket_name )
1052+
1053+ def eviction_policy_noop_no_restart_storage_mode_migration_test (
1054+ self ,
1055+ ):
1056+ """
1057+ Start a storage mode migration with an eviction policy change using
1058+ --noRestart.
1059+ Then send an evictionPolicy update without --noRestart but with the
1060+ identical bucket-level eviction policy value, and verify it's treated as
1061+ a no-op:
1062+ - No per-node eviction overrides disappear
1063+ - No per-node storage mode overrides disappear
1064+ """
1065+ bucket_name = "bucket-evict-noop-test"
1066+
1067+ # Create couchstore + valueOnly
1068+ create_bucket (
1069+ self .cluster , bucket_name , "couchstore" , 1024 , "valueOnly"
1070+ )
1071+
1072+ # Begin migration to magma and change eviction policy with --noRestart
1073+ # This should add per-node storage_mode=couchstore and
1074+ # eviction_policy=valueOnly overrides
1075+ update_data = {
1076+ "name" : bucket_name ,
1077+ "storageBackend" : "magma" ,
1078+ "evictionPolicy" : "fullEviction" ,
1079+ "noRestart" : "true" ,
1080+ }
1081+ self .cluster .update_bucket (update_data )
1082+
1083+ # Capture overrides before the no-op request
1084+ per_node_storage_mode_before = get_per_node_storage_mode (
1085+ self .cluster , bucket_name
1086+ )
1087+ per_node_eviction_policy_before = get_per_node_eviction_policy (
1088+ self .cluster , bucket_name
1089+ )
1090+
1091+ # Sanity: overrides were created as expected
1092+ assert_per_node_storage_mode_keys_added (
1093+ self .cluster , bucket_name , "couchstore"
1094+ )
1095+ assert_per_node_eviction_policy_keys_added (
1096+ self .cluster , bucket_name , "valueOnly"
1097+ )
1098+
1099+ # Now send evictionPolicy again without noRestart but with identical
1100+ # value ("fullEviction"). This should be a no-op and must not delete the
1101+ # per-node eviction overrides
1102+ noop_update = {
1103+ "name" : bucket_name ,
1104+ "evictionPolicy" : "fullEviction" ,
1105+ # noRestart intentionally omitted
1106+ }
1107+ self .cluster .update_bucket (noop_update )
1108+
1109+ # Verify overrides did not disappear
1110+ per_node_storage_mode_after = get_per_node_storage_mode (
1111+ self .cluster , bucket_name
1112+ )
1113+ per_node_eviction_policy_after = get_per_node_eviction_policy (
1114+ self .cluster , bucket_name
1115+ )
1116+
1117+ assert (
1118+ per_node_storage_mode_after == per_node_storage_mode_before
1119+ ), f"per-node storage mode overrides changed on no-op: "
1120+ f"{ per_node_storage_mode_before } -> { per_node_storage_mode_after } "
1121+
1122+ assert (
1123+ per_node_eviction_policy_after == per_node_eviction_policy_before
1124+ ), f"per-node eviction overrides changed on no-op: "
1125+ f"{ per_node_eviction_policy_before } -> { per_node_eviction_policy_after } "
1126+
1127+ # And that they are still the expected values
1128+ assert_per_node_storage_mode_keys_added (
1129+ self .cluster , bucket_name , "couchstore"
1130+ )
1131+ assert_per_node_eviction_policy_keys_added (
1132+ self .cluster , bucket_name , "valueOnly"
1133+ )
1134+
1135+ self .cluster .delete_bucket (bucket_name )
0 commit comments