@@ -12,6 +12,7 @@ use std::future::Future;
1212use std:: panic:: RefUnwindSafe ;
1313use std:: path:: PathBuf ;
1414use std:: sync:: Mutex ;
15+ #[ cfg( all( jwt_auth_test, feature = "test_utils" ) ) ]
1516use std:: time:: SystemTime ;
1617
1718#[ cfg( all( jwt_auth_test, feature = "test_utils" ) ) ]
@@ -29,6 +30,7 @@ use lightning::util::test_utils;
2930use lightning:: { check_closed_broadcast, io} ;
3031use rand:: distr:: Alphanumeric ;
3132use rand:: { rng, Rng } ;
33+ #[ cfg( all( jwt_auth_test, feature = "test_utils" ) ) ]
3234use serde:: { Deserialize , Serialize } ;
3335
3436type TestMonitorUpdatePersister < ' a , K > = MonitorUpdatingPersister <
@@ -41,7 +43,7 @@ type TestMonitorUpdatePersister<'a, K> = MonitorUpdatingPersister<
4143> ;
4244
4345const EXPECTED_UPDATES_PER_PAYMENT : u64 = 5 ;
44- #[ cfg( jwt_auth_test) ]
46+ #[ cfg( all ( jwt_auth_test, feature = "test_utils" ) ) ]
4547pub const VSS_PRIVATE_PEM : & str = r#"
4648-----BEGIN PRIVATE KEY-----
4749MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCuIYJJ1dzNmuct
@@ -388,7 +390,7 @@ pub(crate) fn do_test_store<K: KVStoreSync + Sync>(store_0: &K, store_1: &K) {
388390 check_persisted_data ! ( persister_0_max_pending_updates * 2 * EXPECTED_UPDATES_PER_PAYMENT + 1 ) ;
389391}
390392
391- #[ cfg( jwt_auth_test) ]
393+ #[ cfg( all ( jwt_auth_test, feature = "test_utils" ) ) ]
392394#[ derive( Serialize , Deserialize ) ]
393395struct TestClaims {
394396 sub : String ,
@@ -397,7 +399,7 @@ struct TestClaims {
397399 exp : i64 ,
398400}
399401
400- #[ cfg( jwt_auth_test) ]
402+ #[ cfg( all ( jwt_auth_test, feature = "test_utils" ) ) ]
401403pub fn generate_test_jwt ( private_pem : & str , user_id : & str ) -> String {
402404 let now = SystemTime :: now ( ) . duration_since ( SystemTime :: UNIX_EPOCH ) . unwrap ( ) . as_secs ( ) as i64 ;
403405
@@ -416,7 +418,7 @@ pub fn get_fixed_headers() -> HashMap<String, String> {
416418 {
417419 return HashMap :: new ( ) ;
418420 }
419- #[ cfg( jwt_auth_test) ]
421+ #[ cfg( all ( jwt_auth_test, feature = "test_utils" ) ) ]
420422 {
421423 let token = generate_test_jwt ( VSS_PRIVATE_PEM , "test" ) ;
422424 let mut headers = HashMap :: new ( ) ;
@@ -429,6 +431,6 @@ pub fn get_fixed_headers() -> HashMap<String, String> {
429431 todo ! ( )
430432 }
431433
432- #[ cfg( not( any( noop_auth_test, jwt_auth_test, sig_auth_test) ) ) ]
434+ #[ cfg( not( any( noop_auth_test, all ( jwt_auth_test, feature = "test_utils" ) , sig_auth_test) ) ) ]
433435 HashMap :: new ( )
434436}
0 commit comments