@@ -11,6 +11,7 @@ use lighthouse_network::PeerId;
1111use std:: fs:: File ;
1212use std:: io:: { Read , Write } ;
1313use std:: net:: { IpAddr , Ipv4Addr , Ipv6Addr } ;
14+ use std:: path:: Path ;
1415use std:: path:: PathBuf ;
1516use std:: process:: Command ;
1617use std:: str:: FromStr ;
@@ -1460,77 +1461,82 @@ fn disable_inbound_rate_limiter_flag() {
14601461#[ test]
14611462fn http_allow_origin_flag ( ) {
14621463 CommandLineTest :: new ( )
1463- . flag ( "http-allow-origin" , Some ( "127.0.0.99" ) )
1464+ . flag ( "http" , None )
1465+ . flag ( "http-allow-origin" , Some ( "http://127.0.0.99" ) )
14641466 . run_with_zero_port ( )
14651467 . with_config ( |config| {
1466- assert_eq ! ( config. http_api. allow_origin, Some ( "127.0.0.99" . to_string( ) ) ) ;
1468+ assert_eq ! (
1469+ config. http_api. allow_origin,
1470+ Some ( "http://127.0.0.99" . to_string( ) )
1471+ ) ;
14671472 } ) ;
14681473}
14691474#[ test]
14701475fn http_allow_origin_all_flag ( ) {
14711476 CommandLineTest :: new ( )
1477+ . flag ( "http" , None )
14721478 . flag ( "http-allow-origin" , Some ( "*" ) )
14731479 . run_with_zero_port ( )
14741480 . with_config ( |config| assert_eq ! ( config. http_api. allow_origin, Some ( "*" . to_string( ) ) ) ) ;
14751481}
14761482#[ test]
14771483fn http_allow_sync_stalled_flag ( ) {
14781484 CommandLineTest :: new ( )
1485+ . flag ( "http" , None )
14791486 . flag ( "http-allow-sync-stalled" , None )
14801487 . run_with_zero_port ( )
14811488 . with_config ( |config| assert_eq ! ( config. http_api. allow_sync_stalled, true ) ) ;
14821489}
14831490#[ test]
14841491fn http_enable_beacon_processor ( ) {
14851492 CommandLineTest :: new ( )
1493+ . flag ( "http" , None )
14861494 . run_with_zero_port ( )
14871495 . with_config ( |config| assert_eq ! ( config. http_api. enable_beacon_processor, true ) ) ;
14881496
14891497 CommandLineTest :: new ( )
1498+ . flag ( "http" , None )
14901499 . flag ( "http-enable-beacon-processor" , Some ( "true" ) )
14911500 . run_with_zero_port ( )
14921501 . with_config ( |config| assert_eq ! ( config. http_api. enable_beacon_processor, true ) ) ;
14931502
14941503 CommandLineTest :: new ( )
1504+ . flag ( "http" , None )
14951505 . flag ( "http-enable-beacon-processor" , Some ( "false" ) )
14961506 . run_with_zero_port ( )
14971507 . with_config ( |config| assert_eq ! ( config. http_api. enable_beacon_processor, false ) ) ;
14981508}
14991509#[ test]
15001510fn http_tls_flags ( ) {
1501- let dir = TempDir :: new ( ) . expect ( "Unable to create temporary directory" ) ;
15021511 CommandLineTest :: new ( )
1512+ . flag ( "http" , None )
15031513 . flag ( "http-enable-tls" , None )
1504- . flag (
1505- "http-tls-cert" ,
1506- dir. path ( ) . join ( "certificate.crt" ) . as_os_str ( ) . to_str ( ) ,
1507- )
1508- . flag (
1509- "http-tls-key" ,
1510- dir. path ( ) . join ( "private.key" ) . as_os_str ( ) . to_str ( ) ,
1511- )
1514+ . flag ( "http-tls-cert" , Some ( "tests/tls/cert.pem" ) )
1515+ . flag ( "http-tls-key" , Some ( "tests/tls/key.rsa" ) )
15121516 . run_with_zero_port ( )
15131517 . with_config ( |config| {
15141518 let tls_config = config
15151519 . http_api
15161520 . tls_config
15171521 . as_ref ( )
15181522 . expect ( "tls_config was empty." ) ;
1519- assert_eq ! ( tls_config. cert, dir . path ( ) . join ( "certificate.crt ") ) ;
1520- assert_eq ! ( tls_config. key, dir . path ( ) . join ( "private. key") ) ;
1523+ assert_eq ! ( tls_config. cert, Path :: new ( "tests/tls/cert.pem ") ) ;
1524+ assert_eq ! ( tls_config. key, Path :: new ( "tests/tls/ key.rsa ") ) ;
15211525 } ) ;
15221526}
15231527
15241528#[ test]
15251529fn http_spec_fork_default ( ) {
15261530 CommandLineTest :: new ( )
1531+ . flag ( "http" , None )
15271532 . run_with_zero_port ( )
15281533 . with_config ( |config| assert_eq ! ( config. http_api. spec_fork_name, None ) ) ;
15291534}
15301535
15311536#[ test]
15321537fn http_spec_fork_override ( ) {
15331538 CommandLineTest :: new ( )
1539+ . flag ( "http" , None )
15341540 . flag ( "http-spec-fork" , Some ( "altair" ) )
15351541 . run_with_zero_port ( )
15361542 . with_config ( |config| assert_eq ! ( config. http_api. spec_fork_name, Some ( ForkName :: Altair ) ) ) ;
0 commit comments