some reengineering to support proper testing
This commit is contained in:
		
							
								
								
									
										17
									
								
								xt/lib/App/NetdiscoX/Worker/Plugin/TestOne.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								xt/lib/App/NetdiscoX/Worker/Plugin/TestOne.pm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| package App::NetdiscoX::Worker::Plugin::TestOne; | ||||
|  | ||||
| use Dancer ':syntax'; | ||||
| use App::Netdisco::Worker::Plugin; | ||||
| use aliased 'App::Netdisco::Worker::Status'; | ||||
|  | ||||
| # info 'test: workers are run in decreasing priority until done'; | ||||
|  | ||||
| register_worker({ phase => 'main', driver => 'cli' }, sub { | ||||
|   return Status->noop('NOT OK: CLI driver is not the winner here.'); | ||||
| }); | ||||
|  | ||||
| register_worker({ phase => 'main', driver => 'snmp' }, sub { | ||||
|   return Status->done('OK: SNMP driver is successful.'); | ||||
| }); | ||||
|  | ||||
| true; | ||||
							
								
								
									
										17
									
								
								xt/lib/App/NetdiscoX/Worker/Plugin/TestTwo.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								xt/lib/App/NetdiscoX/Worker/Plugin/TestTwo.pm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| package App::NetdiscoX::Worker::Plugin::TestTwo; | ||||
|  | ||||
| use Dancer ':syntax'; | ||||
| use App::Netdisco::Worker::Plugin; | ||||
| use aliased 'App::Netdisco::Worker::Status'; | ||||
|  | ||||
| # info 'test: lower priority driver not run if higher is successful'; | ||||
|  | ||||
| register_worker({ phase => 'main', driver => 'snmp' }, sub { | ||||
|   return Status->done('NOT OK: SNMP driver should NOT be run.'); | ||||
| }); | ||||
|  | ||||
| register_worker({ phase => 'main', driver => 'cli' }, sub { | ||||
|   return Status->done('OK: CLI driver is successful.'); | ||||
| }); | ||||
|  | ||||
| true; | ||||
		Reference in New Issue
	
	Block a user