@@ -200,9 +200,7 @@ impl Node {
200
200
}
201
201
202
202
/// Returns a list of all node names with enclaves.
203
- pub fn get_node_names_with_enclaves (
204
- & self ,
205
- ) -> Result < Vec < ( String , String , String ) > , RclrsError > {
203
+ pub fn get_node_names_with_enclaves ( & self ) -> Result < Vec < ( NodeNameInfo , String ) > , RclrsError > {
206
204
// SAFETY: Getting a zero-initialized value is always safe
207
205
let ( mut rcl_names, mut rcl_namespaces, mut rcl_enclaves) = unsafe {
208
206
(
@@ -241,8 +239,10 @@ impl Node {
241
239
. zip ( enclaves_slice. iter ( ) )
242
240
. map ( |( ( name, namespace) , enclave) | unsafe {
243
241
(
244
- CStr :: from_ptr ( * name) . to_string_lossy ( ) . into_owned ( ) ,
245
- CStr :: from_ptr ( * namespace) . to_string_lossy ( ) . into_owned ( ) ,
242
+ NodeNameInfo {
243
+ name : CStr :: from_ptr ( * name) . to_string_lossy ( ) . into_owned ( ) ,
244
+ namespace : CStr :: from_ptr ( * namespace) . to_string_lossy ( ) . into_owned ( ) ,
245
+ } ,
246
246
CStr :: from_ptr ( * enclave) . to_string_lossy ( ) . into_owned ( ) ,
247
247
)
248
248
} )
@@ -528,26 +528,30 @@ mod tests {
528
528
529
529
let names_and_namespaces = node. get_node_names ( ) . unwrap ( ) ;
530
530
531
- assert_eq ! (
532
- names_and_namespaces,
533
- vec![ NodeNameInfo {
534
- name: node_name. to_string( ) ,
535
- namespace: "/" . to_string( )
536
- } ]
537
- ) ;
531
+ // The tests are executed in parallel, so we might see some other nodes
532
+ // in here. That's why we can't use assert_eq.
533
+ assert ! ( names_and_namespaces. contains( & NodeNameInfo {
534
+ name: node_name. to_string( ) ,
535
+ namespace: "/" . to_string( )
536
+ } ) ) ;
538
537
}
539
538
540
539
#[ test]
541
540
fn test_node_names_with_enclaves ( ) {
542
541
let context = Context :: new ( [ ] ) . unwrap ( ) ;
543
- let node_name = "test_node_names " ;
542
+ let node_name = "test_node_names_with_enclaves " ;
544
543
let node = Node :: new ( & context, node_name) . unwrap ( ) ;
545
544
546
545
let names_and_namespaces = node. get_node_names_with_enclaves ( ) . unwrap ( ) ;
547
546
548
- assert_eq ! (
549
- names_and_namespaces,
550
- vec![ ( node_name. to_string( ) , "/" . to_string( ) , "/" . to_string( ) ) ]
551
- ) ;
547
+ // The tests are executed in parallel, so we might see some other nodes
548
+ // in here. That's why we can't use assert_eq.
549
+ assert ! ( names_and_namespaces. contains( & (
550
+ NodeNameInfo {
551
+ name: node_name. to_string( ) ,
552
+ namespace: "/" . to_string( )
553
+ } ,
554
+ "/" . to_string( )
555
+ ) ) ) ;
552
556
}
553
557
}
0 commit comments