@@ -22,12 +22,16 @@ pub struct TestExamplesInput {
2222 pub router_config : RouterConfig ,
2323 pub rules : Vec < Rule > ,
2424 pub max_hops : u8 ,
25+ #[ serde( default ) ]
26+ pub project_domains : Vec < String > ,
2527}
2628
2729#[ derive( Deserialize , Debug , Clone , Default ) ]
2830pub struct TestExamplesProjectInput {
2931 pub change_set : RuleChangeSet ,
3032 pub max_hops : u8 ,
33+ #[ serde( default ) ]
34+ pub project_domains : Vec < String > ,
3135}
3236
3337#[ derive( Serialize , Debug , Clone , Default ) ]
@@ -70,7 +74,11 @@ impl TestExamplesOutput {
7074 pub fn from_project ( test_examples_input : TestExamplesProjectInput , existing_router : Arc < Router < Rule > > ) -> TestExamplesOutput {
7175 let test_example_router = test_examples_input. change_set . update_existing_router ( existing_router) ;
7276
73- Self :: create_result ( & test_example_router, test_examples_input. max_hops )
77+ Self :: create_result (
78+ & test_example_router,
79+ test_examples_input. max_hops ,
80+ test_examples_input. project_domains ,
81+ )
7482 }
7583
7684 pub fn create_result_without_project ( test_examples_input : TestExamplesInput ) -> TestExamplesOutput {
@@ -80,10 +88,10 @@ impl TestExamplesOutput {
8088 router. insert ( rule. clone ( ) ) ;
8189 }
8290
83- Self :: create_result ( & router, test_examples_input. max_hops )
91+ Self :: create_result ( & router, test_examples_input. max_hops , test_examples_input . project_domains )
8492 }
8593
86- fn create_result ( router : & Router < Rule > , max_hops : u8 ) -> TestExamplesOutput {
94+ fn create_result ( router : & Router < Rule > , max_hops : u8 , project_domains : Vec < String > ) -> TestExamplesOutput {
8795 let mut results = TestExamplesOutput :: default ( ) ;
8896
8997 for ( id, route) in router. routes ( ) {
@@ -94,7 +102,15 @@ impl TestExamplesOutput {
94102 }
95103
96104 for example in examples. as_ref ( ) . unwrap ( ) . iter ( ) {
97- Self :: test_example ( router, example, & mut results, id. as_str ( ) , route. clone ( ) , max_hops) ;
105+ Self :: test_example (
106+ router,
107+ example,
108+ & mut results,
109+ id. as_str ( ) ,
110+ route. clone ( ) ,
111+ max_hops,
112+ project_domains. clone ( ) ,
113+ ) ;
98114 }
99115 }
100116
@@ -108,6 +124,7 @@ impl TestExamplesOutput {
108124 id : & str ,
109125 route : Arc < Route < Rule > > ,
110126 max_hops : u8 ,
127+ project_domains : Vec < String > ,
111128 ) {
112129 if example. unit_ids_applied . is_none ( ) {
113130 return ;
@@ -172,7 +189,7 @@ impl TestExamplesOutput {
172189 None ,
173190 ) ;
174191 } else {
175- let redirection_loop = RedirectionLoop :: from_example ( router, max_hops, example) ;
192+ let redirection_loop = RedirectionLoop :: from_example ( router, max_hops, example, project_domains ) ;
176193
177194 if redirection_loop. has_error_too_many_hops ( ) || redirection_loop. has_error_loop ( ) {
178195 results. add_failed_example (
0 commit comments