@@ -841,7 +841,7 @@ mod tests {
841841 SubnetRecordBuilder , add_single_subnet_record, add_subnet_list_record,
842842 } ;
843843 use ic_test_utilities_types:: ids:: { SUBNET_1 , node_test_id, subnet_test_id} ;
844- use rstest :: rstest ;
844+ use strum :: IntoEnumIterator ;
845845
846846 use super :: * ;
847847
@@ -983,28 +983,22 @@ mod tests {
983983 ) ;
984984 }
985985
986- #[ rstest ]
987- fn nftables_golden_assigned_replica_test (
986+ #[ test ]
987+ fn nftables_golden_assigned_replica_test ( ) {
988988 // For assigned replicas, only Type4 (cloud engine) nodes have a different firewall
989- #[ values(
990- None ,
991- Some ( NodeRewardType :: Unspecified ) ,
992- Some ( NodeRewardType :: Type0 ) ,
993- Some ( NodeRewardType :: Type1 ) ,
994- Some ( NodeRewardType :: Type2 ) ,
995- Some ( NodeRewardType :: Type3 ) ,
996- Some ( NodeRewardType :: Type3dot1 ) ,
997- Some ( NodeRewardType :: Type1dot1 )
998- ) ]
999- reward_type : Option < NodeRewardType > ,
1000- ) {
1001- golden_test (
1002- Role :: AssignedReplica ( SUBNET_ID ) ,
1003- node_test_id ( 0 ) ,
1004- reward_type,
1005- NFTABLES_ASSIGNED_REPLICA_GOLDEN_BYTES ,
1006- "assigned_replica" ,
1007- ) ;
989+ for reward_type in NodeRewardType :: iter ( )
990+ . filter ( |reward_type| * reward_type != NodeRewardType :: Type4 )
991+ . map ( Some )
992+ . chain ( std:: iter:: once ( None ) )
993+ {
994+ golden_test (
995+ Role :: AssignedReplica ( SUBNET_ID ) ,
996+ node_test_id ( 0 ) ,
997+ reward_type,
998+ NFTABLES_ASSIGNED_REPLICA_GOLDEN_BYTES ,
999+ "assigned_replica" ,
1000+ ) ;
1001+ }
10081002 }
10091003
10101004 #[ test]
@@ -1018,28 +1012,22 @@ mod tests {
10181012 ) ;
10191013 }
10201014
1021- #[ rstest ]
1022- fn nftables_unassigned_replica_golden_test (
1015+ #[ test ]
1016+ fn nftables_unassigned_replica_golden_test ( ) {
10231017 // For unassigned replicas, only Type4 (cloud engine) nodes have a different firewall
1024- #[ values(
1025- None ,
1026- Some ( NodeRewardType :: Unspecified ) ,
1027- Some ( NodeRewardType :: Type0 ) ,
1028- Some ( NodeRewardType :: Type1 ) ,
1029- Some ( NodeRewardType :: Type2 ) ,
1030- Some ( NodeRewardType :: Type3 ) ,
1031- Some ( NodeRewardType :: Type3dot1 ) ,
1032- Some ( NodeRewardType :: Type1dot1 )
1033- ) ]
1034- reward_type : Option < NodeRewardType > ,
1035- ) {
1036- golden_test (
1037- Role :: UnassignedReplica ,
1038- node_test_id ( 0 ) ,
1039- reward_type,
1040- NFTABLES_UNASSIGNED_REPLICA_GOLDEN_BYTES ,
1041- "unassigned_replica" ,
1042- ) ;
1018+ for reward_type in NodeRewardType :: iter ( )
1019+ . filter ( |reward_type| * reward_type != NodeRewardType :: Type4 )
1020+ . map ( Some )
1021+ . chain ( std:: iter:: once ( None ) )
1022+ {
1023+ golden_test (
1024+ Role :: UnassignedReplica ,
1025+ node_test_id ( 0 ) ,
1026+ reward_type,
1027+ NFTABLES_UNASSIGNED_REPLICA_GOLDEN_BYTES ,
1028+ "unassigned_replica" ,
1029+ ) ;
1030+ }
10431031 }
10441032
10451033 #[ test]
@@ -1053,64 +1041,48 @@ mod tests {
10531041 ) ;
10541042 }
10551043
1056- #[ rstest]
1057- fn nftables_golden_boundary_node_system_subnet_test (
1058- // For boundary nodes, the node reward type has no effect on the firewall
1059- #[ values(
1060- None ,
1061- Some ( NodeRewardType :: Unspecified ) ,
1062- Some ( NodeRewardType :: Type0 ) ,
1063- Some ( NodeRewardType :: Type1 ) ,
1064- Some ( NodeRewardType :: Type2 ) ,
1065- Some ( NodeRewardType :: Type3 ) ,
1066- Some ( NodeRewardType :: Type3dot1 ) ,
1067- Some ( NodeRewardType :: Type1dot1 ) ,
1068- Some ( NodeRewardType :: Type4 )
1069- ) ]
1070- reward_type : Option < NodeRewardType > ,
1071- ) {
1044+ #[ test]
1045+ fn nftables_golden_boundary_node_system_subnet_test ( ) {
10721046 // pick the node id such that the API BN's SOCKS proxy serves system subnet nodes
10731047 // the assert checks that
10741048 let api_bn_id_for_system_subnet = node_test_id ( 0 ) ;
10751049 assert ! ( api_bn_id_for_system_subnet < node_test_id( API_BOUNDARY_NODE_ID ) ) ;
10761050
1077- golden_test (
1078- Role :: BoundaryNode ,
1079- api_bn_id_for_system_subnet,
1080- reward_type,
1081- NFTABLES_BOUNDARY_NODE_SYSTEM_SUBNET_GOLDEN_BYTES ,
1082- "boundary_node_system_subnet" ,
1083- ) ;
1051+ // For boundary nodes, the node reward type has no effect on the firewall
1052+ for reward_type in NodeRewardType :: iter ( )
1053+ . map ( Some )
1054+ . chain ( std:: iter:: once ( None ) )
1055+ {
1056+ golden_test (
1057+ Role :: BoundaryNode ,
1058+ api_bn_id_for_system_subnet,
1059+ reward_type,
1060+ NFTABLES_BOUNDARY_NODE_SYSTEM_SUBNET_GOLDEN_BYTES ,
1061+ "boundary_node_system_subnet" ,
1062+ ) ;
1063+ }
10841064 }
10851065
1086- #[ rstest]
1087- fn nftables_golden_boundary_node_app_subnet_test (
1088- // For boundary nodes, the node reward type has no effect on the firewall
1089- #[ values(
1090- None ,
1091- Some ( NodeRewardType :: Unspecified ) ,
1092- Some ( NodeRewardType :: Type0 ) ,
1093- Some ( NodeRewardType :: Type1 ) ,
1094- Some ( NodeRewardType :: Type2 ) ,
1095- Some ( NodeRewardType :: Type3 ) ,
1096- Some ( NodeRewardType :: Type3dot1 ) ,
1097- Some ( NodeRewardType :: Type1dot1 ) ,
1098- Some ( NodeRewardType :: Type4 )
1099- ) ]
1100- reward_type : Option < NodeRewardType > ,
1101- ) {
1066+ #[ test]
1067+ fn nftables_golden_boundary_node_app_subnet_test ( ) {
11021068 // pick the node id such that the API BN's SOCKS proxy serves app subnet nodes
11031069 // the assert checks that
11041070 let api_bn_id_for_app_subnet = node_test_id ( 1234 ) ;
11051071 assert ! ( api_bn_id_for_app_subnet > node_test_id( API_BOUNDARY_NODE_ID ) ) ;
11061072
1107- golden_test (
1108- Role :: BoundaryNode ,
1109- api_bn_id_for_app_subnet,
1110- reward_type,
1111- NFTABLES_BOUNDARY_NODE_APP_SUBNET_GOLDEN_BYTES ,
1112- "boundary_node_app_subnet" ,
1113- ) ;
1073+ // For boundary nodes, the node reward type has no effect on the firewall
1074+ for reward_type in NodeRewardType :: iter ( )
1075+ . map ( Some )
1076+ . chain ( std:: iter:: once ( None ) )
1077+ {
1078+ golden_test (
1079+ Role :: BoundaryNode ,
1080+ api_bn_id_for_app_subnet,
1081+ reward_type,
1082+ NFTABLES_BOUNDARY_NODE_APP_SUBNET_GOLDEN_BYTES ,
1083+ "boundary_node_app_subnet" ,
1084+ ) ;
1085+ }
11141086 }
11151087
11161088 /// Runs [`Firewall::check_for_firewall_config`] and compares the output against the specified
0 commit comments