@@ -542,7 +542,7 @@ mod host_data_test{
542
542
resource_record_valid. set_ttl ( 1000 ) ;
543
543
let rrstore_data_valid = RRStoredData :: new ( resource_record_valid. clone ( ) ) ;
544
544
545
- let mut resource_record_invalid = ResourceRecord :: new ( a_rdata) ;
545
+ let mut resource_record_invalid = ResourceRecord :: new ( a_rdata. clone ( ) ) ;
546
546
resource_record_invalid. set_ttl ( 4 ) ;
547
547
let rrstore_data_invalid = RRStoredData :: new ( resource_record_invalid) ;
548
548
@@ -552,8 +552,8 @@ mod host_data_test{
552
552
let mut domain_name_2 = DomainName :: new ( ) ;
553
553
domain_name_2. set_name ( String :: from ( "example.com" ) ) ;
554
554
555
- cache_by_domain_name. add_to_host_data ( domain_name_1. clone ( ) , rrstore_data_valid) ;
556
- cache_by_domain_name. add_to_host_data ( domain_name_2. clone ( ) , rrstore_data_invalid) ;
555
+ cache_by_domain_name. add_to_host_data ( domain_name_1. clone ( ) , rrstore_data_valid. clone ( ) ) ;
556
+ cache_by_domain_name. add_to_host_data ( domain_name_2. clone ( ) , rrstore_data_invalid. clone ( ) ) ;
557
557
558
558
assert_eq ! ( cache_by_domain_name. get_domain_names_data( ) . len( ) , 2 ) ;
559
559
if let Some ( rr_cache_vec) = cache_by_domain_name. get_domain_names_data ( ) . get ( & domain_name_1) {
@@ -569,13 +569,13 @@ mod host_data_test{
569
569
//clean the data with expired ttl
570
570
cache_by_domain_name. filter_timeout_host_data ( ) ;
571
571
572
- println ! ( "The new cache is {:?} " , cache_by_domain_name. get_domain_names_data( ) ) ;
572
+ // println!("The new cache is {:?} ", cache_by_domain_name.get_domain_names_data());
573
573
574
574
//check if the value who survives is the same
575
- if let Some ( rr_cache_vec) = cache_by_domain_name. get_domain_names_data ( ) . get ( & domain_name_2 ) {
575
+ if let Some ( rr_cache_vec) = cache_by_domain_name. get_domain_names_data ( ) . get ( & domain_name_1 ) {
576
576
if let Some ( rrstore_data) = rr_cache_vec. get ( 0 ) {
577
- let resocurce_record_after_clean = rrstore_data . get_resource_record ( ) ;
578
- assert_eq ! ( resocurce_record_after_clean , resource_record_valid ) ;
577
+ println ! ( "the rrstore for domain {:?} afther de timeout is {:?} " , domain_name_1 . get_name ( ) , rrstore_data ) ;
578
+ assert_eq ! ( rrstore_data_valid , rrstore_data . clone ( ) ) ;
579
579
}
580
580
}
581
581
//after the filter shoud be just one data in the cache (example.com shoud have been eliminated)
0 commit comments