@@ -11,6 +11,7 @@ use lighthouse_network::PeerId;
11
11
use std:: fs:: File ;
12
12
use std:: io:: { Read , Write } ;
13
13
use std:: net:: { IpAddr , Ipv4Addr , Ipv6Addr } ;
14
+ use std:: path:: Path ;
14
15
use std:: path:: PathBuf ;
15
16
use std:: process:: Command ;
16
17
use std:: str:: FromStr ;
@@ -1460,77 +1461,82 @@ fn disable_inbound_rate_limiter_flag() {
1460
1461
#[ test]
1461
1462
fn http_allow_origin_flag ( ) {
1462
1463
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" ) )
1464
1466
. run_with_zero_port ( )
1465
1467
. 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
+ ) ;
1467
1472
} ) ;
1468
1473
}
1469
1474
#[ test]
1470
1475
fn http_allow_origin_all_flag ( ) {
1471
1476
CommandLineTest :: new ( )
1477
+ . flag ( "http" , None )
1472
1478
. flag ( "http-allow-origin" , Some ( "*" ) )
1473
1479
. run_with_zero_port ( )
1474
1480
. with_config ( |config| assert_eq ! ( config. http_api. allow_origin, Some ( "*" . to_string( ) ) ) ) ;
1475
1481
}
1476
1482
#[ test]
1477
1483
fn http_allow_sync_stalled_flag ( ) {
1478
1484
CommandLineTest :: new ( )
1485
+ . flag ( "http" , None )
1479
1486
. flag ( "http-allow-sync-stalled" , None )
1480
1487
. run_with_zero_port ( )
1481
1488
. with_config ( |config| assert_eq ! ( config. http_api. allow_sync_stalled, true ) ) ;
1482
1489
}
1483
1490
#[ test]
1484
1491
fn http_enable_beacon_processor ( ) {
1485
1492
CommandLineTest :: new ( )
1493
+ . flag ( "http" , None )
1486
1494
. run_with_zero_port ( )
1487
1495
. with_config ( |config| assert_eq ! ( config. http_api. enable_beacon_processor, true ) ) ;
1488
1496
1489
1497
CommandLineTest :: new ( )
1498
+ . flag ( "http" , None )
1490
1499
. flag ( "http-enable-beacon-processor" , Some ( "true" ) )
1491
1500
. run_with_zero_port ( )
1492
1501
. with_config ( |config| assert_eq ! ( config. http_api. enable_beacon_processor, true ) ) ;
1493
1502
1494
1503
CommandLineTest :: new ( )
1504
+ . flag ( "http" , None )
1495
1505
. flag ( "http-enable-beacon-processor" , Some ( "false" ) )
1496
1506
. run_with_zero_port ( )
1497
1507
. with_config ( |config| assert_eq ! ( config. http_api. enable_beacon_processor, false ) ) ;
1498
1508
}
1499
1509
#[ test]
1500
1510
fn http_tls_flags ( ) {
1501
- let dir = TempDir :: new ( ) . expect ( "Unable to create temporary directory" ) ;
1502
1511
CommandLineTest :: new ( )
1512
+ . flag ( "http" , None )
1503
1513
. 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" ) )
1512
1516
. run_with_zero_port ( )
1513
1517
. with_config ( |config| {
1514
1518
let tls_config = config
1515
1519
. http_api
1516
1520
. tls_config
1517
1521
. as_ref ( )
1518
1522
. 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 ") ) ;
1521
1525
} ) ;
1522
1526
}
1523
1527
1524
1528
#[ test]
1525
1529
fn http_spec_fork_default ( ) {
1526
1530
CommandLineTest :: new ( )
1531
+ . flag ( "http" , None )
1527
1532
. run_with_zero_port ( )
1528
1533
. with_config ( |config| assert_eq ! ( config. http_api. spec_fork_name, None ) ) ;
1529
1534
}
1530
1535
1531
1536
#[ test]
1532
1537
fn http_spec_fork_override ( ) {
1533
1538
CommandLineTest :: new ( )
1539
+ . flag ( "http" , None )
1534
1540
. flag ( "http-spec-fork" , Some ( "altair" ) )
1535
1541
. run_with_zero_port ( )
1536
1542
. with_config ( |config| assert_eq ! ( config. http_api. spec_fork_name, Some ( ForkName :: Altair ) ) ) ;
0 commit comments