Ravn::Tactical::Operation::
Test
class
Ravn-tactical Operation for testing the task queue.
new( fail: false, result: 'array' )
Overridden to specify the valid config options.
22 def initialize( fail: false, result: 'array' )
23 super
24 end
Return a block for Roda::RodaPlugins::TypecastParams validation for this operation.
13 def self::param_validator
14 return ->( params ) do
15 params.bool( 'fail', false )
16 params.nonempty_str( 'result' )
17 end
18 end
after_run( node, response )
Do post-proceessing/teardown after the run.
48 def after_run( node, response )
49 self.log.info "Response from %p was: %p" % [ node, response ]
50 return super
51 end
Do any preparation before the run.
28 def before_run( node )
29 self.log.info "Testing operations on %p" % [ node ]
30 super
31 end
Either echo stuff back in the log, or raise if the fail
option is set.
35 def run( * )
36 self.log.info "Running the `test' operation."
37 raise "Failed!" if self.config[ :fail ]
38
39 if self.config[ :result ] == 'object'
40 return { result: 'Success.' }
41 else
42 return [ 'Success.' ]
43 end
44 end