@@ -9,8 +9,8 @@ use crate::agent_control::config_validator::DynamicConfigValidator;
99use crate :: agent_control:: error:: AgentError ;
1010use crate :: agent_control:: uptime_report:: UptimeReporter ;
1111use crate :: event:: {
12- channel:: { EventConsumer , EventPublisher } ,
1312 AgentControlEvent , ApplicationEvent , OpAMPEvent , SubAgentEvent ,
13+ channel:: { EventConsumer , EventPublisher } ,
1414} ;
1515use crate :: opamp:: remote_config:: report:: OpampRemoteConfigStatus ;
1616use crate :: opamp:: {
@@ -436,18 +436,18 @@ fn sub_agents_difference<'a>(
436436
437437#[ cfg( test) ]
438438mod tests {
439+ use crate :: agent_control:: AgentControl ;
439440 use crate :: agent_control:: agent_control:: sub_agents_difference;
440441 use crate :: agent_control:: agent_id:: AgentID ;
441442 use crate :: agent_control:: config:: {
442443 AgentControlConfig , AgentControlDynamicConfig , SubAgentConfig ,
443444 } ;
444445 use crate :: agent_control:: config_storer:: loader_storer:: tests:: MockAgentControlDynamicConfigStore ;
445- use crate :: agent_control:: config_validator:: tests:: MockDynamicConfigValidator ;
446446 use crate :: agent_control:: config_validator:: DynamicConfigValidatorError ;
447+ use crate :: agent_control:: config_validator:: tests:: MockDynamicConfigValidator ;
448+ use crate :: agent_control:: resource_cleaner:: ResourceCleanerError ;
447449 use crate :: agent_control:: resource_cleaner:: no_op:: NoOpResourceCleaner ;
448450 use crate :: agent_control:: resource_cleaner:: tests:: MockResourceCleaner ;
449- use crate :: agent_control:: resource_cleaner:: ResourceCleanerError ;
450- use crate :: agent_control:: AgentControl ;
451451 use crate :: agent_type:: agent_type_id:: AgentTypeID ;
452452 use crate :: agent_type:: agent_type_registry:: AgentRepositoryError ;
453453 use crate :: event:: channel:: pub_sub;
@@ -460,7 +460,7 @@ mod tests {
460460 use crate :: sub_agent:: health:: health_checker:: { Healthy , Unhealthy } ;
461461 use crate :: sub_agent:: tests:: MockStartedSubAgent ;
462462 use crate :: sub_agent:: tests:: MockSubAgentBuilder ;
463- use mockall:: { predicate , Sequence } ;
463+ use mockall:: { Sequence , predicate } ;
464464 use std:: collections:: HashMap ;
465465 use std:: sync:: Arc ;
466466 use std:: thread:: { sleep, spawn} ;
@@ -1113,9 +1113,11 @@ agents:
11131113 ) ] ) ) ) ,
11141114 ) ;
11151115
1116- assert ! ( agent_control
1117- . apply_remote_agent_control_config( & remote_config, & mut running_sub_agents)
1118- . is_err( ) ) ;
1116+ assert ! (
1117+ agent_control
1118+ . apply_remote_agent_control_config( & remote_config, & mut running_sub_agents)
1119+ . is_err( )
1120+ ) ;
11191121
11201122 assert_eq ! ( running_sub_agents. len( ) , 1 ) ;
11211123
@@ -1380,9 +1382,12 @@ agents:
13801382 let ev = agent_control_consumer. as_ref ( ) . recv ( ) . unwrap ( ) ;
13811383 assert_eq ! ( expected, ev) ;
13821384
1383- let expected = AgentControlEvent :: AgentControlBecameUnhealthy ( Unhealthy :: new ( String :: default ( ) , String :: from (
1384- "Error applying Agent Control remote config: remote config error: `config hash: `a-hash` config error: `some error message``" ,
1385- ) ) ) ;
1385+ let expected = AgentControlEvent :: AgentControlBecameUnhealthy ( Unhealthy :: new (
1386+ String :: default ( ) ,
1387+ String :: from (
1388+ "Error applying Agent Control remote config: remote config error: `config hash: `a-hash` config error: `some error message``" ,
1389+ ) ,
1390+ ) ) ;
13861391 let ev = agent_control_consumer. as_ref ( ) . recv ( ) . unwrap ( ) ;
13871392 assert_eq ! ( expected, ev) ;
13881393 }
@@ -1647,12 +1652,14 @@ agents:
16471652 let diff: Vec < _ > = sub_agents_difference ( & old_sub_agents, & new_sub_agents) . collect ( ) ;
16481653
16491654 assert_eq ! ( diff. len( ) , 2 ) ;
1650- assert ! ( diff
1651- . iter( )
1652- . any( |( id, _) | id == &&AgentID :: new( "infra-agent" ) . unwrap( ) ) ) ;
1653- assert ! ( diff
1654- . iter( )
1655- . any( |( id, _) | id == &&AgentID :: new( "nrdot" ) . unwrap( ) ) ) ;
1655+ assert ! (
1656+ diff. iter( )
1657+ . any( |( id, _) | id == &&AgentID :: new( "infra-agent" ) . unwrap( ) )
1658+ ) ;
1659+ assert ! (
1660+ diff. iter( )
1661+ . any( |( id, _) | id == &&AgentID :: new( "nrdot" ) . unwrap( ) )
1662+ ) ;
16561663 }
16571664
16581665 #[ test]
0 commit comments